Failed to show images with "set fileName"

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 7:34 pm

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
/*Whats all the fuss with c# ?*/

Klaus
Posts: 10397
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Failed to show images with "set fileName"

Post by Klaus » Wed Dec 20, 2017 7:37 pm

Hi Peter,

what did you script to set "the filename"?


Best

Klaus

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 7:49 pm

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
/*Whats all the fuss with c# ?*/

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2737
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Failed to show images with "set fileName"

Post by richmond62 » Wed Dec 20, 2017 7:53 pm

imageSauce.png
This worked for me (LC 7.1.4, Mac OS 10.7.5) 8)

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 8:02 pm

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.
/*Whats all the fuss with c# ?*/

Klaus
Posts: 10397
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Failed to show images with "set fileName"

Post by Klaus » Wed Dec 20, 2017 8:05 pm

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.

bogs
Posts: 2289
Joined: Sat Feb 25, 2017 10:45 pm

Re: Failed to show images with "set fileName"

Post by bogs » Wed Dec 20, 2017 8:08 pm

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.
Image

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 8:13 pm

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.
/*Whats all the fuss with c# ?*/

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 8:19 pm

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
/*Whats all the fuss with c# ?*/

Klaus
Posts: 10397
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Failed to show images with "set fileName"

Post by Klaus » Wed Dec 20, 2017 8:26 pm

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.

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 8:42 pm

It's an absolute pathname.

C:/Users/UserName/AppData/Local/Temp/Cell-Images/fileName
/*Whats all the fuss with c# ?*/

Klaus
Posts: 10397
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Failed to show images with "set fileName"

Post by Klaus » Wed Dec 20, 2017 9:01 pm

And you store it like:
...
set the whatever of wherever to specialfolderpath("temporary") & "/Cell-Images/"
...
right?

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 9:13 pm

That is correct!
/*Whats all the fuss with c# ?*/

Klaus
Posts: 10397
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Failed to show images with "set fileName"

Post by Klaus » Wed Dec 20, 2017 9:19 pm

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
...

Peter@multidesk.se
Posts: 105
Joined: Fri Oct 14, 2011 6:53 am

Re: Failed to show images with "set fileName"

Post by Peter@multidesk.se » Wed Dec 20, 2017 10:05 pm

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
/*Whats all the fuss with c# ?*/

Post Reply

Return to “Windows”