Export card IMAGE (Re: question regarding print out of objects)

FlexibleLearning at aol.com FlexibleLearning at aol.com
Thu Mar 13 05:14:33 EDT 2008


Change "of this cd" to "of this stack" and you'll get the expected  result...

>You could automate the screenshot part in Revolution  ...
>
>repeat with x = 1 to the number of cds
>  go cd  x
>  put "snapshot" & x & ".jpg" into tfilename
>   export snapshot from rect (the rect of this cd) to file tfilename as  JPEG
>end repeat


As an alternative, Ken Ray wrote a neat  routine that export the card IMAGE 
rather than a screenShot (in which other  windows can get in the way), and the 
stack does not even have to be visible,  on-screen or even fit the  monitor...

----------------------------------------------------------
>From the Scripter's  Scrapbook:
----------------------------------------------------------
SUMMARY:
How  to Export a Card Image (Not a Screenshot!)

There are many times you might  want to export the contents of a card to a 
JPG or PNG file, and  MetaCard/Revolution’s built in export snapshot command 
takes a literal  screenshot, so things like palettes and toolbars can get in the 
way of getting a  clean image of the card. Additionally, you might have a 
stack window which is  larger than the current monitor, and need to export the 
card image; export  snapshot just won't cut it in these cases.

The following script allows  you to export a card image to disk.

Update: 8/17/03: It turns out that  his works with stack windows that are 
hidden or totally  offscreen.

CONTENT:
ExportCard  pStackPath,pExportPath,pImageType
-- pStackPath is the path to the  stack whose card you want to export
-- pExportPath is where you want  the image to go
-- pImageType is one of the three formats supported by  the export
--   command: paint, png or jpeg
put  the alwaysBuffer of stack pStackPath into tOldBuffer
-- The next two  lines force the current card image into the offscreen buffer
set the  alwaysBuffer of stack pStackPath to false
set the alwaysBuffer of  stack pStackPath to true
create invisible image
-- Here's  the 'meat' of the handler:
set the imagePixMapID of last image to (the  pixMapID of stack pStackPath)
select last image
set the  alwaysBuffer of stack pStackPath to tOldBuffer
do "export" &&  pImageType && "to file pExportPath"
delete last  image
choose browse tool
end ExportCard

Note that this will  only export what is visible in the stack window; that 
is, if you have a  scrolling group on the card, you won't get everything inside 
the group - you  would need to resize the stack to accomodate everything 
before you did an  ExportCard.

Posted 3/31/03 by Ken Ray, based on original code by Brian  Yennie (thanks, 
Brian!)

SOURCE:
Ken Ray,  3/31/03
----------------------------------------------------------

/H
 



   



More information about the use-livecode mailing list