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" />

Related Topics

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
  • CAPTURETYPE="virtual"
  • CAPTURETYPE="active_window"
  • CAPTURETYPE="specified_desktop"
  • CAPTURETYPE="region"
The type of screen capture to perform. The available options are:
  • Primary screen (default) - Screen capture will be performed on the primary screen. In a multi-monitor environment, the primary screen is the view of the main monitor. This is designated as primary (main) display in Windows Display Settings.
  • Virtual screen - Screen capture will be performed on the virtual screen. In a multi-monitor environment, the virtual screen is the complete view of all monitors attached to the system.
  • Active window - Screen capture will be performed on the active (currently focused) window. For example, if you have three programs open at the same time, you might want a screen capture of only the active window.
  • Specified desktop - Screen capture will be performed on the specified desktop. In a multi-monitor environment, each desktop is designated by a particular display number.
  • Specified region - Screen capture will be performed on the specified region designated by screen coordinates along with width and height measured in pixels.
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.

Description

Error Causes

On Error

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

NOTE:
  • The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
  • Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.

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.

Copy
<AMIMAGE ACTIVITY="capture_screen" FILE="c:\temp\screenshot.jpg" CAPTURETYPE="active_window" RESULTDATASET="screenshotData" />