Saving snapshots to files

Wilhelm Sanke sanke at hrz.uni-kassel.de
Sat Mar 13 14:47:11 EST 2004


Klaus Major wrote not long ago:

> Yes, it reads:
>
> export snapshot [from rect[angle] rectangle [of window windowID]] \
>     to {file filePath |container} [as format] [with mask maskFile]
>
> Has anybody succesfully used this command?
>
> I tried EVERYTHING, like storing the windowId into a variable first
> etc...


Klaus and Ken,

The "export snapshot" command works with Rev 2.1.2 or Metacard 2.5.1 or 
higher (2.2.B1 and 2.6a2).

Elementary script:

on mouseUp
   put the rect of image 1 into trect
   put the windowID of this stack into StackID
   export snapshot from rect trect of window StackID to file 
"ImageTest.jpg" as JPEG
 end mouseUp

If you want to save snapshots consecutively in a special folder "images" 
- if I understand correctly this is about what Ken wanted - something 
like this works (tested on Windows XP with Metacard 2.5.1):

on mouseUp
   put the directory into OldDir
   put OldDir&"/"&"images" into NewDir
   set the directory to NewDir
   #===computes the number of files in folder "images"and sets new image 
name ==
   put the number of lines of the files into ImageNumber
   put "ImageTest"&(Imagenumber + 1)&".jpg" into NewImageName
   #==========================================================
   put the rect of image 1 into trect
   put the windowID of this stack into StackID
   export snapshot from rect trect of window StackID to file 
NewImageName as JPEG
   set the directory to OldDir
end mouseUp

Cheers,

Wilhelm



More information about the use-livecode mailing list