Another Export Snapshot Problem

Dave dave at looktowindward.com
Tue Mar 20 07:59:28 EDT 2007


Hi,


On 20 Mar 2007, at 11:51, Bryan McCormick wrote:
> Dave,
>
> Oddly the code only worked when I removed the "of window  
> myWindowID" reference. Then it was fine. Otherwise I got the same  
> error that you did. I am not sure if this is a bug or if export  
> won't take a window id param for some reason.


I was just going by the documentation (copied below). Interestingly  
syntax line(at the top) has changed since Version 2.6.6.152, but it's  
still mentioned later on:

If you specify a windowID, the rectangle's coordinates are relative  
to the top left corner of the window you specify. However, if the  
window is partly overlapped by another window, whatever is visible on  
the screen within that rectangle is placed in the snapshot. In other  
words, you cannot take a snapshot of a part of a window that is  
hidden by another overlapping window.

This now begs another question, if it doesn't work with a Window ID  
now, how can I get the coordinates of an object I want to export.  
Also does it still grab a part of the screen? IOW, if the user covers  
this window with another window will it still output the window  
contents or will it output whatever happens to be at the location  
specified?

All the Best
Dave



export snapshot

Type: command

Syntax:
export snapshot [from rect[angle] rectangle] [of object] to {file  
filePath |container} [as format] [with mask maskFile]

See Also: export command, import snapshot command, rectangle  
property, screenRect function, windowID property

Introduced: 2.1

Changed: 2.1

Platform Support:

Summary:
Creates a picture file from a portion of the screen.

Examples:
export snapshot to file "Test.ppm"
export snapshot from rect "0,0,200,200" to file "Nav.jpg" as JPEG
export snapshot to pictVariable as GIF


Use the export snapshot command to export a screenshot to a file or  
container.

Parameters:
The rectangle specifies the edges of the rectangle to be imported,  
separated by commas, in the same order as the rectangle property  
(left, top, right, bottom).

   Important!  If a window, stack or object is specified, the  
rectangle is given in relative (window) coordinates; otherwise, it is  
given in absolute coordinates.

The filePath specifies the name and location of the file you want to  
export to. If you specify a name but not a location, the file is  
created in the defaultFolder.
The container is a reference to a container, usually an image or a URL.
The format is one of the following: paint, JPEG, GIF, or PNG.
The maskFile specifies the name and location of a file to export as  
an image mask. You can use a maskFile only when exporting in PBM  
format (paint).

To export a snapshot for a portion of a stack you use the form:
export snapshot from rect[angle]  of window windowId to ...
Where windowId is the windowId property of the required stack.
To export a snapshot of a specific (non-stack) object, use the form:
export snapshot from [rect[angle] ] of chunk to ...
Where chunk is any chunk expression resolving to a control, or any  
expression evaluating to a control reference.

Comments:
If you use the form export format to..., the selected image is exported.
The export snapshot...as paint form exports the image as a PBM, PGM,  
or PPM file, depending on the screen depth. (Optionally, you can  
specify a location for the mask file.) The export snapshot...as JPEG  
form exports as a JPEG file, and the export snapshot...as PNG form  
exports as a PNG file. If you don't specify a format, the file is  
exported as PBM, PGM, or PPM.

   Tip:  If the image has an alpha channel, the export snapshot...as  
PNG form creates a 32-bit PNG file.
If taking a snapshot of an object, the rectangle's coordinates are  
relative to the top left corner of the card containing the object.  
The object is rendered into an image as if no other objects existed  
around it, the snapshot is taken without applying the object's  
blendlevel or ink. You can take a snapshot of an object regardless of  
its visibility or open status - in particular, snapshots can be taken  
of objects that are not on the current card or in stacks that are not  
open.

If you don't specify a rectangle, Revolution displays a crosshairs  
cursor. Click at one corner of the rectangle to be imported and drag  
to the opposite corner to select the area.

If you specify a windowID, the rectangle's coordinates are relative  
to the top left corner of the window you specify. However, if the  
window is partly overlapped by another window, whatever is visible on  
the screen within that rectangle is placed in the snapshot. In other  
words, you cannot take a snapshot of a part of a window that is  
hidden by another overlapping window.












More information about the use-livecode mailing list