Image - Capture screen
Declaration
<AMIMAGE ACTIVITY="capture_screen" FILE="text" CAPTURETYPE="text (options)" DESKTOPNUMBER="number" X="number" Y="number" WIDTH="number" HEIGHT="number" RESULTDATASET="text" OVERWRITEFILE="YES/NO" />
Description
Captures a screen shot of the primary screen, virtual screen, active window, specified desktop or a particular region of the screen, populates a dataset with the results and about specified. of the desktop and populates a dataset with results.
Practical usage
Can be used save an image screen shot in order to demonstrate an application, program, error or output that needs to be shown to others or archived. Can also be used to retrieve precise pixel coordinates.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Capture | Text (options) | No | Primary screen |
|
The type of screen capture
to perform. The available options are:
|
Specified desktop | Number | Yes, if the Capture parameter set to Specified desktop | (Empty) | DESKTOPNUMBER="2" | The desktop number that the screen capture should be performed on. In a multi-monitor environment, each desktop is designated by a particular display number as specified in Windows Display Settings (for example, 1,2). This parameter is active only if the Capture parameter is set to Specified desktop. |
Top | Number | Yes, if the Capture parameter set to Specified desktop | (Empty) | X="250" | The X (top) coordinate measured in pixels. The X coordinate is a given number of pixels along the horizontal axis of a display starting from the pixel (pixel 0) on the extreme left of the screen. This parameter is active only if the Capture parameter is set to Specified region. |
Left | Number | Yes, if the Capture parameter set to Specified desktop | (Empty) | Y="200" | The Y coordinate measured in pixels. This is a given number of pixels along the vertical axis of a display starting from the pixel (pixel 0) at the top of the screen. This parameter is active only if the Capture parameter is set to Specified region. |
Width | Number | Yes, if the Capture parameter set to Specified desktop | (Empty) | WIDTH="500" | The total width of the area to capture measured in pixels. This parameter is active only if the Capture parameter is set to Specified region. |
Height | Number | Yes, if the Capture parameter set to Specified desktop | (Empty) | HEIGHT="800" | The total height of the area to capture measured in pixels. This parameter is active only if the Capture parameter is set to Specified region. |
Image path | Text | Yes | (Empty) | FILE="c:\temp\theScreenShot.png" | The screen capture's output path, file name and type. Supported file types are JPG, JPEG, PNG, BMP, TIF, TIFF, and GIF. |
Overwrite existing file | Yes/No | No | Yes | OVERWRITEFILE="NO" | If set to YES (default), matching files found in the destination folder will be overwritten. If set to NO, an error will occur during runtime as a result of a matching file. |
Advanced
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Create and populate dataset | Text | No | (Empty) | DATASET="datasetName" | The name of a dataset to create and populate with information about this activity's results. For more details, see Datasets below. |
Additional notes
Datasets
A dataset is a multi-column, multi-row object that contains a collection of information gathered during execution of an activity and stored in memory. This activity creates and populates a dataset with the following fields (rows):
Name | Type | Return Value |
---|---|---|
theDataset.FileName | Text | The absolute path (or full path and file name) in which the screen capture was saved to. |
theDataset.Height | Number | The height of the screen capture measured in pixels. |
theDataset.ImageFormat | Text | The image file format used to save the screen capture (for example, png, jpg). |
theDataset.Left | Number | The left most pixel coordinate of the screen capture. |
theDataset.Top | Number | The top most pixel coordinate of the screen capture. |
theDataset.Width | Number | The width of the screen capture measured in pixels. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
This sample task captures an image of the active window, saves it as a JPG formatted image, and then creates and populates a dataset with the results.
<AMIMAGE ACTIVITY="capture_screen" FILE="c:\temp\screenshot.jpg" CAPTURETYPE="active_window" RESULTDATASET="screenshotData" />