Page 1 of 2

Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 7:34 pm
by Peter@multidesk.se
When I set the "fileName" of my image, I get "could not open image".

There is nothing wrong with the pathway, this seems to be a similar issue to my previous problem, to delete a file that it I resolved by closing the file before I try to delete it.

http://forums.livecode.com/viewtopic.php?f=18&t=30304

if I copy the pathway and then set the property inspector for the image to it, nothing happens. This applies to all images that I somehow handle in the application.

For example, if I set the pathway to a desktop image before I use it in the application, it works. However, after the program has copied it, it will not work.

Suggestions, anyone?

///Peter

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 7:37 pm
by Klaus
Hi Peter,

what did you script to set "the filename"?


Best

Klaus

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 7:49 pm
by Peter@multidesk.se
Hi Klaus,

The fastest respons ever, I think. :wink:


put the defaultFolder into tFolder
repeat with x = 1 to the number of lines in theImage
if x = 7
then
answer "You can't save more than six images !"
exit repeat
end if
put line x of theImage into myImage
put tFolder & "/" & myImage into tImagePath
set the filename of image ("image" & x) to tImagePath
end repeat

And the script works, the image get the pathway and it's correct, but the images won't show for some reason.


///peter

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 7:53 pm
by richmond62
imageSauce.png
This worked for me (LC 7.1.4, Mac OS 10.7.5) 8)

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:02 pm
by Peter@multidesk.se
I've forgotten to say that there is no problem on Mac, It's when I try to run my application on windows that it fails.

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:05 pm
by Klaus
The script looks OK, but be sure to doublecheck that THE DEFAULTFOLDER is really set to the folder you need here! You were setting this a couple of times in the other thread, so better check it.

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:08 pm
by bogs
What Klaus said, and this may also be an area where you would want to put in a custom property to store the path instead of default folder, as then you would be always sure it is correct.

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:13 pm
by Peter@multidesk.se
If I check the property of the image after I've run my script I can see that the pathway is correct. If I copy / paste that into the explorer the image pops up on the screen.

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:19 pm
by Peter@multidesk.se
Bogs,

I've actually use custom property to store my pathways, I just tried to set the default folder to it after I've run into all of this problems.

///Peter

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:26 pm
by Klaus
Is that a relative or absolute pathname? How dou you set it? And to what?

If something works on a Mac but not on Windows like here, it is a pathname problem mot of the time.

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 8:42 pm
by Peter@multidesk.se
It's an absolute pathname.

C:/Users/UserName/AppData/Local/Temp/Cell-Images/fileName

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 9:01 pm
by Klaus
And you store it like:
...
set the whatever of wherever to specialfolderpath("temporary") & "/Cell-Images/"
...
right?

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 9:13 pm
by Peter@multidesk.se
That is correct!

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 9:19 pm
by Klaus
Hmmmm....? :shock:

Did you try (just to be sure):

Code: Select all

...
  put line x of theImage into myImage
  put tFolder & "/" & myImage into tImagePath
  answer (there is a file tImagePath)
  ## Should be TRUE of course
  set the filename of image ("image" & x) to tImagePath
end repeat
...

Re: Failed to show images with "set fileName"

Posted: Wed Dec 20, 2017 10:05 pm
by Peter@multidesk.se
Now I have!

I got False, but the file is there.!? (Yes I can see it)

I've also got the result "could not open image"

But the path of the image is set to the right path, and the same path works just fine in the explorer...

I am really REALLY confused!

Klaus,
Is there anyway I can persuade you to take a look at my stack to see if you can locate the problem?


///Peter