Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Pattern-Recognition >

Image/Pixel-Color Operations

ANA.SnapFind1 - Snap and Patternsearch

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.Snapfind1

Snapshot current Window and start a Pattern-Find-Operation

 

 

Intention

 

The 'Snapfind' command is an integral tool for locating and clicking a pattern within a window. It seamlessly merges the 'ANA.Snap' and 'ANA.FindPattern' commands, providing a robust solution for pattern recognition and interaction.

Moreover, it includes a feature for adjusting the target point by a specific pixel distance, offering you precision control.

 

The Snapfind command operates as follows:

 

1.It captures a snapshot of the current window, storing it in internal IR No. 24.

2.It loads the desired pattern into internal IR No. 23.

3.It executes the FindPattern command with IR 23 and 24.

4.If a match is identified, it utilizes the MAP.-Command to locate the first found object (as E9 with the size 8x8).

5.Subsequent to this, if a 'MMV.' or 'MLC.' etc. is written, the mouse will swiftly move to the point and execute the click.

 

The Snapfind command also provides a Target Adjustment feature, enabling the user to shift the target from the found position by a predetermined amount. This feature is beneficial in scenarios where the user needs to locate a point and click in a different location, such as identifying a checkmark using its text, but clicking on the checkmark box. An example of this would be locating checkmarks in an 'Unsupported Browser'."

 

 

Checkmarks

 

Instead of searching the Circles to click on, like in the following picture ....

 

Checkmarkk Pattern

 

You can search the unique Text and then specify an Coordinate Adjustment - where to click.

In this case you can not accidentally click the wrong checkmarks.

 

Cehcmark2

 

 

In this Example,

ANA.Snapfind1|$$LAA|0|0|1|55,-10|1

will directly set the Active Point (where the Mouse will move to) to the Target.

This is possible because we use the "55,-10" as adjustments.

 

Snapfind1

 

You can use the long version of Snapfind and use the "Findings on the TOS" this way:

 

'***********************************

' ANA.Snapfind-Sample

'***********************************

STW.ct|Chrome_WidgetWin_1|Amazon - Brave

'SWP.70,89|1195,977|T

$$LAA=?pattern\Checbkm.bmp

ANA.Snapfind1|$$LAA|0|0|1|55,-10|1

' Remove Number of Finds from TOS

POP.$$COO

' Get Coords from TOS

POP.$$COO

' Move Mouse to target

MMV.t|$$COO

ENR.

 

 

With 'Snapfind1', all findings are conveniently left on the TOS.

At position 00, you'll first encounter the number of findings, capped by P6.

Moving on to position 01, you'll discover the coordinate of the first finding, with additional findings listed in the subsequent positions.

 

Snapfind1A

 

 

The short Form of Snapfind1 is to just use the first Finding

which will be automatically localized using an internal MAP. Command.

This way you can also write:

 

'***********************************

' ANA.Snapfind-Sample

'***********************************

STW.ct|Chrome_WidgetWin_1|Amazon - Brave

'SWP.70,89|1195,977|T

$$LAA=?pattern\Checbkm.bmp

ANA.Snapfind1|$$LAA|0|0|1|55,-10|1

' Move Mouse to target and Click

MLC.

ENR.

 

 

 

Syntax

 

ANA.Snapfind1|P1[|P2][|P3][|P4][|P5][|P6]

 

Parameter Explanation

 

P1 - [File]  Pattern-Image File

P2 - opt. Color Tolerance for Search

P3 - opt.Pixel-Hits, this number depends on the total number of Pixel in the Pattern. For example, 63 would be a minimum Hit number of 63 Pixels that must match the Pattern including the Tolerance. If you specify a negative number like "-15" then this is treated as a Percentage of the total Pixel-Number, means "-75" would be 75%. If omitted or 0 the default value will be 85% of Pixel-Number in Pattern.

P4 - opt. Debug-Flag 0/1

P5 - opt. [Coords] this is a coordinate like "0,0" or "-200,-10". This will move the Target Point by the specified amount of Pixels.

P6 - opt. Maximum Number of Finds that should be stored.

 

More Details:

For more detailed Information about P4 and P5 please see ANA.FindPattern

 

 

Example

 

'***********************************

' ANA.Snapfind-Sample 1

'***********************************

STW.ct|Chrome_WidgetWin_1|Amazon - Brave

'SWP.70,89|1195,977|T

$$LAA=?pattern\Checbkm.bmp

ANA.Snapfind1|$$LAA|0|0|1|55,-10|1

' Remove Number of Finds from TOS

POP.$$COO

' Get Coords from TOS

POP.$$COO

' Move Mouse to target

MMV.t|$$COO

ENR.

 

 

'***********************************

' ANA.Snapfind-Sample 2

'***********************************

STW.ct|Chrome_WidgetWin_1|Amazon - Brave

'SWP.70,89|1195,977|T

$$LAA=?pattern\Checbkm.bmp

ANA.Snapfind1|$$LAA|0|0|1|55,-10|1

' Move Mouse to target and Click

MLC.

ENR.

 

 

 

 

Remarks

For more detailed Information about P4 and P5 please see ANA.FindPattern

 

 

Limitations:

 

-

 

 

See also:

 

    ANA_FindPattern