CaptureScreen Method

Saves the current desktop as a .png file.

System.CaptureScreen(filePath)

Client support

   Newlook Smartclient only.

Version Support

Introduced in Version 11.0.10.

Parameters

filePath- (String, Required)

String value specifying the name (and optional path) of the file to be saved.

The path specified can be absolute or relative to the default Newlook solution folder.

If no file extension is specified in the filePath parameter, this method will add a '.png' extension to the file. If a file name extension other than '.png' is specified, it will be retained however '.png' will be appended to the end of the file name (for example, 'myScreenshot.txt' will become 'myScreenshot.txt.png').

If the file specified already exists, the existing file will be replaced.

Use

This method provides users with a mechanism to capture the current user desktop as a .png file, without a dialog appearing. It is intended to assist in trouble-shooting.

Returns

This method returns the final file path of the saved file. Any exception during this save action will generate a runtime error.

EXAMPLES

The following script captures the current desktop as the file 'myScreen.png' in the folder C:\ScreenCaptures.

J SCRIPT

function CaptureDesktop()

{

var savedFilePath = System.CaptureScreen("C:\\ScreenCaptures\\myScreen.png");

}

 

The following script captures the user's desktop as a png file, where it's name is derived from System.User value. The file will be saved in the default Newlook solution path.

J SCRIPT

function CaptureDesktop()

{

var screenUser = System.Username;

var savedFilePath = System.CaptureScreen(screenUser);

}

 

The following macros uses the RunMethod action to capture the current desktop as the file 'Error.png' in the default Newlook solution path.

MACRO ACTION

RunMethod(System, CaptureScreen, "Error", vSavedFilePath)

See Also

Save method | Debugging scripts | Err object

Applies To

System Object


© 2004-2021 looksoftware. All rights reserved.