Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > Non-IR Operations >

Image/Pixel-Color Operations

IRA. / NRA. - If Rectangular area Altered

Previous Top Next


MiniRobotLanguage (MRL)

 

IRA. / NRA. Conditional Statement

If RECT Altered

 

 

Intention

 

Conditional Statement.

 

Test if an rectangular Area (RECT) that was previously defined using RRA. has changed.

 

General Usage is as simple as:

 

STW.ct|MyClassName|Sample Application

SCW.nct|1|Edit|{&NOTEXT:}

' Remember the Area

RRA.

' Now check if it has changed

IRA.

 DBP.Areaa ha changed!

ELS.

 DBP.Area has not changed!

EIF.

ENR.

 

The two possible parameters are Color-Tolerance and Hit-Counter.

 

Color Tolerance:

 

If there are different  graphic cards used, the pixels may not become rendered always in the exactly same way. Therefore the color tolerance gives you the chance to tell the robot "How sensitive" he should be when deciding if a pixel is different or not.

To make this decision, the robot will take the color of both pixels and calculate their "Color distance", that is "How similar the colors are". As a result he will get a number that can vary from 0 to 441673. Next Smart Package Robot  will get your tolerance value and check if the calculated color distance is inside the chosen tolerance or not.

 

Hits-Counter:

 

Imagine a Textbox like this:

 

graphic

 

You want to wait until there is a text inside, but the blinking cursor should not make your Script react. Now what you tell Smart Package Robot  is a "Hit Count" of lets say 100 Pixels.

 

STW.ct|MyClassName|Sample Application

SCW.nct|1|Edit|{&NOTEXT:}

RRA.

:again

PAU..1

IRA.0|100

 GTO.over

ELS.

 GTO.again

EIF.

:over

ENR.

 

This makes Smart Package Robot  count the changed pixels, and only if she gets more then "Hit Count" she will switch. Otherwise the condition will not become true, even if there are changed pixels (but less).

 

 

 

 

NRA. is the negative version "If Not Rect altered".

 

 

 

Syntax

 

IRA.[P1][|P2]… ELS. … EIF.

 

 

Parameter Explanation

 

P1 - (optional) numeric/variable contains the Tolerance to be used when checking if a color is different. You can specify the color tolerance as a numeric value  from  0 - 441673, or you can specify a percentage from 0% to 100%. If you specify a percentage, just add the % Sign after the number. The color tolerance is the maximum allowed Color-Distance between two colors. The maximum color distance is 441673 that is the distance between black and white. If you omit this parameter, the system will use a zero Tolerance. In this case the colors are just "equal or not equal".

 

P2 - (optional) numeric/variable contains the minimum number of "Hits" that are pixels that have to be different to make the decision to become "true".

 

IRA.'s can be nested to unlimited Depth, and they can also enclose Sub-Program Calls or FEX. (Enumerations) to unlimited Depth.

 

 

 

Example

 

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

' IRA.-Sample

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

STW.t|Sample

RRA.

' In this 2 seconds time you can change something in the window

' or just move the window around.

PAU.2

IRA.

MBX.Rect was altered!

ELS.

MBX.Rect was NOT altered!

EIF.

END.

 

 

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

' IRA.-Sample 2

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

' Use "Sample Application"

' Click into the left Edit-Field to end the Loop

STW.ct|MyClassName|Sample Application

SCW.nct|1|Edit|{&NOTEXT:}

RRA.

:again

PAU..1

IRA.

 GTO.over

ELS.

 GTO.again

EIF.

:over

ENR.

 

 

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

' IRA.-Sample 2

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

' Use "Sample Application"

' Now we use a Hit-Count of 100

' The blinking Cursor will NOT switch

' But if you type something

'

STW.ct|MyClassName|Sample Application

SCW.nct|1|Edit|{&NOTEXT:}

RRA.

:again

PAU..1

IRA.0|100

 GTO.over

ELS.

 GTO.again

EIF.

:over

ENR.

 

 

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

 

 

 

See also:

 

    ! Smart Package Robot 's Pixel-Operations

    RRA. - Remember Rectangular Area

    WRA. - Wait Rect-Area Altered