Image - Capture screen

Declaration

<AMIMAGE ACTIVITY="capture_screen" FILE="text" CAPTURETYPE="text (options)" 
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 particular region of the desktop and populates a dataset with the results.  

Practical Usage

Can be used to create a screen shot to demonstrate an application or program, a particular error or problem or generally to display output that needs to be shown to others or archived.

Parameters

General

Property

Type

Required

Default

Markup

Description

Capture

Text (options)

No

Primary screen

  1. CAPTURETYPE="primary_screen"

  2. CAPTURETYPE="virtual"

  3. CAPTURETYPE="active_window"

  4. CAPTURETYPE="specified_desktop"

  5. 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 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 (e.g., 1,2). This parameter is active only if theCaptureparameter is set toSpecified desktop.

Top

Number

Yes if Capture parameter set to Specified region

(Empty)

X="250"

The top or x coordinate measured in pixels. Thexcoordinate 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 theCaptureparameter is set toSpecified region.

Left

Number

Yes if Capture parameter set to Specified region

(Empty)

Y="200"

The left or 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 theCaptureparameter is set toSpecified region.

Width

Number

Yes if Capture parameter set to Specified region

(Empty)

WIDTH="500"

The total width of the area to capture measured in pixels. This parameter is active only if theCaptureparameter is set toSpecified region.

Height

Number

Yes if Capture parameter set to Specified region

(Empty)

HEIGHT="800"

The total height of the area to capture measured in pixels. This parameter is active only if theCaptureparameter is set toSpecified 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 JPEG, PNG and BMP.

Overwrite existing file

Yes/No

No

Yes

OVERWRITEFILE="NO"

If set toYES(default), matching files found in the destination folder will be overwritten. If set toNO, 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 regarding the captured screen. For more details, see Datasets below.

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

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 path and fil name the screen capture was saved to.

theDataset.Height

Number

The height of the screen capture measured in pixels.

theDataset.ImageFormat

Text

The format (e.g., PNG, BMP) used to save the screen capture.

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

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Captures an image of the active window and stores it into "c:\temp\screenshot.jpg". Also, create and populate dataset "screenshotData" with results.

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