PDA

View Full Version : image.load from ini values


cchian
04-25-2004, 09:10 PM
My following code is not working, I tried it in the "On Show" and "On preload" action of my main page:

Image.Load("Image1", "AutoPlay\\Images\\strimage");
The variable "strimage" has the name of the image which I read from an INI file. If I replace "strimage" with the image file name, then it works. What am I doing wrong?

Worm
04-25-2004, 09:37 PM
Try this:

Image.Load("Image1", "AutoPlay\\Images\\" .. strimage);


My following code is not working, I tried it in the "On Show" and "On preload" action of my main page:

Image.Load("Image1", "AutoPlay\\Images\\strimage");
The variable "strimage" has the name of the image which I read from an INI file. If I replace "strimage" with the image file name, then it works. What am I doing wrong?

cchian
04-25-2004, 10:01 PM
Hmm, still not working.

Worm
04-25-2004, 10:12 PM
If that doesn't work, then my guess is that the variable isn't getting set, or the image isn't in the path you expect.

Try using
Dialog.Message("Debug", strimage);

to display the value of the variable so you can see what you are working with.

Hmm, still not working.

TJ_Tigger
04-25-2004, 10:44 PM
I try to put the \\ before the AutoPlay folder as well.

Image.Load("Image1", "\\AutoPlay\\Images\\" .. strimage);

cchian
04-25-2004, 10:48 PM
I tried using
Dialog.Message("Debug", strimage);

and it does show file name correctly. The image is in the Autoplay\Images folder. I wonder if the Image.Load action doesn't accept variables?


If that doesn't work, then my guess is that the variable isn't getting set, or the image isn't in the path you expect.

Try using
Dialog.Message("Debug", strimage);

to display the value of the variable so you can see what you are working with.

Intrigued
04-25-2004, 11:37 PM
Here I put together a very simple (one section, one value, and one data) AMS+.ini project together.

I hope this helps at the very least to stimulate a workable solution.

Attachment: INI-TEST-042604

Sincerely,

cchian
04-26-2004, 12:18 AM
Intrigued,
I could not compile your example because AMS it is telling me I am missing several plug-ins. By looking at you code I was able to make it work somewhat by placing images in the root and using this code:

Image.Load("Image1", strimage);

I still would like to find a way for AMS to see the images (using variables) if they are in the Autoplay\Images folder. Probably I am just not using the "correct" syntax, but have tried several ways.

Thanks


Here I put together a very simple (one section, one value, and one data) AMS+.ini project together.

I hope this helps at the very least to stimulate a workable solution.

Attachment: INI-TEST-042604

Sincerely,

pjhiggins
04-26-2004, 01:38 AM
I was able to load an image using a filename from an INI file in the following example.

On Load Tab

-- Get filename from INI file
ImageName = INIFile.GetValue("C:\\images.ini", "Images", "First");

-- Load image into image place holder
Image.Load("Image1", "AutoPlay\\Images\\"..ImageName);


INI file

[Images]
First=image1.png

cchian
04-26-2004, 04:54 PM
pjhiggins, your example worked. I will try to add your logic into my project.
Thanks!

Intrigued
04-26-2004, 05:11 PM
Here is what I had:

INI File (In 'Docs' folder):

[images]
flowers="AutoPlay\\Images\\lilies.png"

On PreLoad (Page1)

selected_pic = INIFile.GetValue("AutoPlay\\Docs\\test.ini", "images", "flowers");

On Show (Page1)

Image.Load("Image1", selected_pic);

Then Images (AutoPlay) Folder contains:

lilies.png



As far as the Plugin technologies still showing in the .apz file, sorry about that. I used "TESTPROJECT" for a lot of different projects and I just took that one and renamed it.

The other .apz file offered is missing the INI file. Seems like another Export Project... that scraped off what files it thought were not in use. I sometimes forget to make sure to have AMS ask me what to disgard before a Export Project... batch processing episode, myself.

Glad you have a working solution nontheless!