If - Pixel exists |
Declaration
<AMIF ACTIVITY="pixel_exists" ACTION="text (options)" XPOS="number" YPOS="number" COLOR="text" />
Description
Determines if the specified pixels is (are) in the specified state and returns TRUE or FALSE depending on the outcome. If TRUE, the task will execute the block of steps immediately following this step up until an End if step is encountered. If FALSE, the block will be skipped and execution will proceed directly after the End if step (or if an Else step is encountered, the task will execute that block of steps instead, up until an End if step is encountered).
Practical Usage
Commonly used to check if a graphic or area of the screen matches (or stops matching) a "checksum" of pixel colors. Very useful for detecting subtle changes in a window's contents that cannot be measure by any other means. In visual mode, it is easy to create the checksum values, while in the properties of the action, simply move the mouse pointer around the target window while repeatedly pressing the INSERT key.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
If | Text (Options) | Yes | Pixel colors match |
| Specifies
the type of pixel check to be performed. The available options
are:
|
X Position | Number | Yes | (Empty) | XPOS="36" | Specifies the X coordinate of the pixels to watch for. To capture pixel coordinates, click the Add button, hover the mouse cursor over the desired area on the screen and press the INSERT key. Multiple pixels / color pairs may be specified. |
Y Position | Number | Yes | (Empty) | XPOS="360" | Specifies the Y coordinate of the pixel to watch for. To capture pixel coordinates, click the Add button, hover the mouse cursor over the desired area on the screen and press the INSERT key. Multiple pixels / color pairs may be specified. |
Color | Number | Yes | (Empty) | COLOR="13160660" | Specifies the colors that the corresponding pixels specified in XPOS and YPOS should match. To capture pixel coordinates, click the Add button, hover the mouse cursor over the desired area on the screen and press the INSERT key. Multiple pixels / color pairs may be specified. |
Coordinates relative to foreground window | Yes/No | No | Yes | RELATIVE="NO" | If enabled, pixel coordinates will be relative to the foreground window. If this parameter is selected, the Coordinates relative to screen parameter is ignored. This parameter is enabled by default. |
Coordinates relative to screen | Yes/No | No | No | RELATIVE="NO" | If enabled, pixel coordinates will be relative to the size of the screen. If this parameter is selected, the Coordinates relative to foreground window parameter is ignored. |
Example
- 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
If pixels matches the ones specified, a message box displays the message "Pixels match." Otherwise, a message box will display "Pixels do not match."
<AMIF ACTIVITY="pixel_exists" XPOS="152,248" YPOS="313,404" COLOR="16777215,12570320" />
<AMSHOWDIALOG MESSAGE="Pixels match." />
<AMELSE />
<AMSHOWDIALOG MESSAGE="Pixels do not match." />
<AMIF ACTIVITY="end" />