hwISession CaptureScreenToSize

Captures the current screen to an image file of the specified pixel resolution.

Syntax

hwISession_handle CaptureScreenToSizetype, filename, height, width, quality

Application

HyperWorks Tcl Query

Inputs

type
The type of file. Options include: BMP, JPEG, TIFF, PNG, Clipboard
filename
The filename of the captured image.
width (Optional)
The width of the captured image in pixels (default in batch mode is 1024, otherwise default is value returned by hwISession::GetPageWidth).
height (Optional)
The height of the captured image in pixels (default in batch mode is 768, otherwise default is value returned by hwISession::GetPageHeight).
quality (Optional)
The level of quality or compression (default is 100). This is used only in JPEG type captures.

Examples

To capture the screen to a PNG type file called MyPicture.png with a resolution of 1600 X 1200 pixels:
hwi GetSessionHandle sess;
sess CaptureScreenToSize png MyPicture.png 1600 1200;
To capture the screen to a JPEG type file called MyPicture.jpg with a resolution of 1600 X 1200 pixels and quality level 60:
hwi GetSessionHandle sess;
sess CaptureScreenToSize jpeg MyPicture.jpg 1600 1200 60;
To capture the screen and copy it to the clipboard with a resolution of 1600 x 1200 pixels and the default quality level of 100:
Note: A dummy file name must be specified.
hwi GetSessionHandle sess1
sess1 CaptureScreen "clipboard" E:\Scratch\CaptureScreenAPI_Test 1600 1200 100;

Error

Success (0) or an error code.