If Pixel Exists Action

Declaration

<AMIFPIXELEXISTS ACTION="options" XPOS="list" YPOS="list" COLOR="list" RELATIVE="yes/no">

See Also

If Pixel Exists Action-Setting Properties, Else Action, End If Action, Loop Action, The BASIC Language All Groups

Description

Causes the steps following this action to execute if the specified pixel(s) is(are) in the specified state. If not, execution follows the next Else or End If action, whichever comes first.

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 Tab

Action

Text, optional default match
MARKUP: ACTION="differ"

Specifies whether to wait for the pixel(s) to match the specified color(s), differ from the specified color(s), or change to any other color.

The available options are:

X Pos

Text, Required
MARKUP: XPOS="36"

Specifies the X coordinate of the pixel(s) to watch for. Multiple pixels/color pairs may be specified by separating the entries with commas. All parameters must have the same number of items specified (unless Action is any [ACTION="any"] in which case color is omitted).

Y Pos

Text, Required
MARKUP: YPOS="36"

Specifies the Y coordinate of the pixel(s) to watch for. Multiple pixels/color pairs may be specified by separating the entries by commas. All parameters must have the same number of items specified (unless Action is any [ACTION="any"] in which case color is omitted).

Color

Text, Required
MARKUP: COLOR="13160660"

Specifies the color(s) that the corresponding pixels specified in XPOS and YPOS should be. Multiple pixels/color pairs may be specified by separating the entries with commas. All parameters must have the same number of items specified (unless Action is any [ACTION="any"] in which case color is omitted).

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMIFPIXELEXISTS XPOS="152,248" YPOS="313,404" COLOR="16777215,12570320">

     <AMMESSAGEBOX>if matches to this</AMMESSAGEBOX>

<AMELSE>

     <AMMESSAGEBOX>if matches to this</AMMESSAGEBOX>

</AMIF>