If - Pixel Exists
Declaration
<AMIF ACTIVITY="pixel_exists" ACTION="text (options)" XPOS="number" YPOS="number" COLOR="text">
Description: Determines if the specified pixel(s) 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.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
If | Text (Options) | Yes | Pixel(s) Matches | ACTION="match" ACTION="differ" |
Specifies the type of pixel check to be performed. The available options are: Pixel colors match - The IF block will be executed if the pixels match the value entered in the X/Y position parameter. Pixel colors don't match - The IF block will be executed if the pixels are different from the value entered in the X/Y position parameter. |
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 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.)
Example
The sample AML code below can be copied and pasted directly into the Steps panel 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>