Page 1 of 1
Drag to desktop
Posted: Thu Sep 16, 2010 5:25 pm
by thehat
I want to save an image that is on a card to either the desktop or a image folder as a jpeg file. Using drop and Drag would be cool.
I tried to drag the image to the desktop.
This doesn't work:
on dragStart
put ID of me into timage
set the dragData["image"] to image ID timage
end dragStart
Thanks for your help
Gregg
Re: Drag to desktop
Posted: Thu Sep 16, 2010 6:30 pm
by Klaus
Hi Gregg,
unfortunately this does not work the way one would exspect and as you tried.
To get a copy of your image somewehre on the desktop or elsewhere, you need to manage "the dragdata["files"]!
Question:
Is this an internal (imported) or referenced image?
Anyway, here we go.
If it is referenced then you could do this:
Code: Select all
on dragStart
set the dragData["files"] to the filename of me
end dragStart
If it is an internal (imported) image you will have to export it to a file first.
In my example I export it to the temp folder, so the user does not see it, which is preferrable
Code: Select all
on dragStart
put specialfolderpath("temporary") & "/Name of your target image here.jpg" into tTargetfile
export img "your image name here" to file tTargetfile as JPEG
## Rev is fast enough, the user will not see any delay!
set the dragData["files"] to tTargetfile
end dragStart
Tested and works
Best from germany
Klaus
Re: Drag to desktop
Posted: Thu Sep 16, 2010 10:24 pm
by thehat
Thank so much. I did get that to work. I had to include .jpeg in the name of the image.
Then it worked like a charm!
Thanks again