Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > Pattern-Search >

Image/Pixel-Color Operations

WTP.- Wait For Two Pattern

Previous Top Next


MiniRobotLanguage (MRL)

 

WTP. Wait For Two Pattern

Wait for appearance of any of two Patterns and then get the Locations and put it on TOS.

 

 

Intention

 

This command will wait until at least one of two specified Pattern will appear or until none of these is found.

You will find the number of the Pattern (1 or 2) that has appeared on the TOS below the Coordinates.

 

It will then find the Locations where the specified Object is and locate the Coordinates immediately.

 

The command can be given a Timeout Value, if this specified time is over the Command will exit and set the Timeout-Flag

and put a "0" on the TOS.

 

This command uses internally multiple Levels (4 Levels) of Fuzzy-Logic.

It will search all of the currently localized Top-Window.

 

The WTP.-Command will use additional Parameters that can be changed using the SFP.-Command.

These are for example the Color-Tolerance and the number of "needed Pixel-Hits".

Hereby Pixel-Hits are the number of Pixels that do match the Pattern using the given Color-Tolerance.

 

Now you can find out which of multiple Patterns was found for example with

  WTP.$$PAA|$$PAB|30,40|60

  GFP.LastPattern|$$PAT

  MBX.$$PAT

 

Please see the LTP.-Commands for more  Details.

 

1. Use WTP with 4 Parameters and default settings

This will include all Screens on a Dual-Screen System. Here we search a Pattern on the complete Desktop.

 

STW.ct|Chrome_Widge|Safir - Brav

SWP.0,0|1098,668|T

VAR.$$PAA=?pattern\Py.bmp

VAR.$$PAB=?pattern\Pa.bmp

WTP.$$PAA|$$PAB|0,0|60

' You can directly ofter the WTP. Command use MMV. or MLC. etc.

MMV.

DMP.6

MBX.!

ENR.

 

 

clip0060

If you Specify P4, then P4 is the timeout value.

On the Stack you will find all the Results limited by "MaxResults".

On TOS is the "Number of Results".

Followed by the Results.

FInally the Pattern Number that was found as the first result (Here it was Pattern Nr.2 / $$PAB).

 

 

2. Use WFP. and set the default Parameters with SFP. before

You can change more advanced Parameters that WFP. uses with the SFP.-Command.

 

STW.ct|Chrome_Widge|Safir - Brav

SWP.0,0|1098,668|T

VAR.$$PAA=?pattern\Py.bmp

VAR.$$PAB=?pattern\Pa.bmp

SFP.ColorTolerance|0

SFP.PixelHits|0

SFP.DebugMode|1

WTP.$$PAA|$$PAB|0,0|60

' You can directly use MMV. or Mouse-Move Command directly after the WTP.

MMV.

' This will show the Stack.

DMP.6

MBX.!

ENR.

 

 

 

 

Syntax

 

WTP.[!]P1|P2[|P3][|P4]

 

Parameter Explanation

 

! - If the ! is specified then the Command will wait for the Patterns to disappear, ("Wait for no Pattern")

 

P1 - Pattern File A - Name and Path
    or Specify "IR:" and Image-Register number for Pattern from an Image-Register..
        or Specify "ID:$$DTA" und directly use Inline-Data as Pattern.

 

P2 - Pattern File B - Name and Path
    or Specify "IR:" and Image-Register number for Pattern from an Image-Register..
        or Specify "ID:$$DTA" und directly use Inline-Data as Pattern.

 

P3 - opt. Destination Point Shift, will be used to move the target point by a specified amount of Pixels.

                   For example, if the Target is found at 100,50 and you specify here -10,40 then the final Point will be at 90,90.

P4 - opt. Timeout value. If 0 or omitted the command will wait "Forever". If  "-1" then the Command will return immediately.

 

The Command will leave the Pattern-Number of the first find on  the TOS, followed by all finds. On the TOS is the number of finds.

 

The Result "0" means "nothing found", a result of -1 means "Error", while a "1" or a higher number shows the number of found matches.

The maximum Number of found Locations is limited by the "Max-Results" Setting that can be changed using the "SFP.-Command".

 

The last found Position will automatically set as the "Active Point".

 

If the Pattern did not appear in the given Time, then you will get a result "0" on TOS and the Timeout-Flag will be set.
The program will not generate an Error-Message.

 

 

Example

 

-

 

 

Remarks

Do not use ".jpg" Images or images that are compressed with Artefacts. Generally use ".bmp" or ".png" Images. Otherwise the result will be hard to predict.

 

Limitations:

The resolution of the Pattern-Images that can be used is limited to those resolutions that can be saved with the "Human Eye-Recorder"-Tool.

 

 

See also:

 

    WFP. - Wait For Pattern