Page 1 of 1

How to save an image and open it later

Posted: Wed Jan 02, 2013 3:02 pm
by Mag
Hi all,

I would like to save an image and then open it later, when opening stack again.

To save the image I'm using this code:

Code: Select all

put the long id of image imageName to longIDofImageName
export image longIDofImageName to file ("file:" & specialFolderPath("documents") & slash & "customPreview.png") as PNG
To open the image later, I'm trying to use this code:

Code: Select all

put specialFolderPath("documents") into tFolderPath
put tFolderPath & "/customPreview.png" into tFilePath
set the filename of image "previewImage" to file tFilePath
I also tryied this:

Code: Select all

put URL ("file:"& tFilePath) into image "previewImage"
to date without any luck! :oops:
I read documentation and examples but I'm afraid I'm missing something...

Re: How to save an image and open it later

Posted: Wed Jan 02, 2013 6:26 pm
by endernafi
Hi Mag,

just minor mistakes...

Try this:

Code: Select all

put the long id of image "imageName" into longIDofImageName
export longIDofImageName to file (specialFolderPath("documents") & slash & "customPreview.png") as png
and this:

Code: Select all

put specialFolderPath("documents") into tFolderPath
put tFolderPath & "/customPreview.png" into tFilePath
set the filename of image "previewImage" to tFilePath
I've tried, both of 'em work.
Don't forget to check out the differences.

Best,

~ Ender Nafi

Re: How to save an image and open it later

Posted: Wed Jan 02, 2013 10:24 pm
by Mag
Thank you so much Ender! There were several errors! :oops: