Using export snapshot with a file dialogue box

Richmond richmondmathewson at gmail.com
Sat Jul 3 13:31:12 EDT 2010


On 07/03/2010 07:19 PM, Steve King wrote:
> Hi
>
> I am exporting a screen image of a card to file.
>
> I allow the user to select a filename then save the image using the script
> below. I have had to add a 400mS wait in for the save dialogue to vanish
> before the snapshot is taken. This works OK, but is there a better way to do
> it that guarantees that the save dialogue will be gone first? At the moment
> I know 100mS is plenty on my system so I have selected 400mS as margin
>
>     ask file  "Save Dive/Air Plan image as:" with the DefaultFolder with
> filter "JPG File, *.JPG"
>     put it into UserFileName
>
>     if it is not empty then
>        set the itemdelimiter to "."
>        if item 2 of UserFileName is empty then
>           put UserFileName&  ".jpg" into UserFileName
>        end if
>        wait 400 milliseconds
>        Put the rect of this stack into MyScreen
>        export snapshot from rect MyScreen to file UserFileName as JPEG
>        Answer "Screen saved as"&  UserFileName with "OK"
>     end if
>
> Cheers
> Steve
>
>    

Have a look at this:

http://andregarzia.on-rev.com/richmond/STUFF/ScreenSnap.rev.zip

pull it to pieces (the scripts are stored in fields for daft, historical
reasons) and 'steal' anything you find useful.

sincerely, Richmond Mathewson.





More information about the use-livecode mailing list