Here is code I use to export a PNG file. The only changes you would need to
make would be the export command and the file name. I chose PNG because the
images I got looked better in PNG format than JPG especially where fine
detail was needed. Note: the variable cardnum is the number of the card
being exported.
put the rect of this cd into srcRect
put the windowID of this wd into wid
hide wd "MetaCard Menu Bar"
hide wd "Message Box"
lock messages
import snapshot from rect srcRect of wd wid
put empty into zerolist
repeat with i=1 to (3-len(cardnum))
put "0" after zerolist
end repeat
put "Card" & zerolist & cardnum & ".png" into tFile
put the number of card images into maximage
select image maxImage
export png to file tFile
delete cd image maximage
unlock messages
show wd "Message Box"
show wd "MetaCard Menu Bar"
I lock messages to keep new image code from running when the new image is
created. I use the repeat loop to pad the card number with zeroes (e.g.
"Card001.png"). You have to keep track of how many images are on the card
since the new snapshot image will be the largest card image number. This is
used to help manipulate the new image since it doesn't have a known name
yet.
You'll want to make sure your card is the topmost stack. I hide the MC
windows prior to taking the snapshot because sometimes in development mode
they are on top of your card. If you don't hide them they'll be in the
snapshot as would any other program's window that might be on top at the
time.
HTH
Larry Huisingh
>
> Does anyone know of a way I can generate a .jpg or .gif file of a
> metacard (windows) window? I know of utilities that will capture the
> screen, but I would like to be able to export a graphic file of the
> screen from within a metacard script.
>
> Thanks,
> mailto:[EMAIL PROTECTED]
>
>
Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.