Wait for Pixel Action Icon

If Pixel Exists

Declaration

<AMIF XPOS="number" YPOS="number" COLOR="number" RELATIVE="YES/NO">

See Also

Else | End If | End Select/Case | Goto | If | If Compare Files | If File Exists | If Folder Exists | If Last Step | If Pixel Exists | If Process Running | If Text Contains | If Windows Exists | Label | Select/Case

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 Properties

Property

Type

Required

Default

Markup

Description

If

Text (Options)

Yes

Pixel(s) Matches

ACTION="differ"

Specifies the type of pixel check to be performed. The available options are:

  • Pixel(s) matches: the IF block will be executed if the pixels match.

  • Pixel(s) is(are) different: the IF block will be executed if the pixels are different.

X Position

Number

Yes

(Empty)

XPOS="36"

Specifies the X coordinate of the pixel(s) 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(s) 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 color(s) 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.

Description Properties

The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.

More on setting custom step description

Error Causes Properties

The Error Causes tab properties lets you instruct a task step to react only to specific errors or ignore certain errors that should cause it to fail.

More on Error Causes properties

On Error Properties

The On Error tab properties lets you determine what the task should do if a particular step encounters an error as defined in the Error Causes properties.

More about On Error properties

Additional Notes

Expressions, Variables & Functions

A percent sign is used as a special character in AutoMate to indicate the beginning and end of an expression. This allows variables, functions and other expressions to be entered in any text parameter of a task's properties. For example: %1+1% inside a task will resolve to 2 at runtime. A more elaborate example is %FileDateTime(myFile)% which results to the date/time of myFile. To help construct expressions, you can open Expression Builder by clicking the Insert Expression (%) button or by pressing F2.

More on expressions

More on variables

More on functions

More on extended functions
More on the expression builder

Example

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

 

Description: If pixel(s) matches the one(s) specified, a message box displays the message "Pixels match." Otherwise, a message box will display ""Pixels do not match."

 

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

     <AMSHOWDIALOG MESSAGE="Pixels match." />

<AMELSE />

     <AMSHOWDIALOG MESSAGE="Pixels do not match." />

</AMIF>

 

↑ [Top of Page]