Window Operations * SCW.

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Window Operations > SCW. - Search-Child-Window >

Window Operations * SCW.

"b" - Flag "backjump"

Previous Top Next


MiniRobotLanguage (MRL)

 

"b"-Flag "backjump"

Search Child Window

 

 

Intention

 

What is the "backjump"?

It's some kind of "rollback", that is done, when a child-window is not immediately found.

If a Child-window (for example a button) is not found, there is a slight danger, that we are inside the wrong Top-Window. Because the SCW. always searches inside the current Top-Window, this behavior could lead to problems. Even if a fitting window with our button would appear, we could not grab it, because we are only searching in a previous window that had the right title.

To prevent this problem and also check new windows if they appear, the SCW.-command may initiate a so called "Backjump" to the previous STW. A Backjump means that the SCW. jumps back to the STW. and this way looks for new windows that may potentially have the button we are looking for.

 

The "b"-flag controls the "Backjump" behavior. It describes the backjump-time in seconds. You can specify fractions of seconds like this "0.5".

And you can completely disable the backjump, if you set the "b"-flag to a value of zero.

 

 

 

Short Examples:

 

' We use just the button caption and the backjump-flag

SCW.tb|Cancel|0

SCW.bt|0|Cancel

 

' Here we set the backjump to 250 ms

' all three commands do technically the same

' we have just changed the order of the parameters

SCW.ctb|Button|Cancel|250

SCW.tbc|Cancel|250|Button

SCW.btc|250|Cancel|Button

 

 

 

 

 

Example

 

'MR Script-file:  

'Version:

'Purpose: STW.-Features Demo

'Author: Theo Gottwald

'Creation date: 09.12.11

'===========================================================

' In the following script we'll make three sorts of backjumps.

' Fast, slow and no backjump.

' Run it from the Editor and follow the script.

'

'#EXE:?pfad\

'#SPI:ForceWrite

'

' Close Testform if already there

CAW.PBWindowClass:0|BCS - Testform

 

' Wait 200 ms

PAU.0.2

 

' Start an Application only, if that Application

' is not yet running.

'

' We use STW here to test if the Application is already running

' in that case we jump over the EXE-command and contine.

' We use the following flags:

' w ... 0 - Set waiting time to 0 seconds

' t ... "BCS - Testform" - this is the caption text of the window we search for

' U ... "found" - jump to Label ":found" if the window already exists

' X ... continue without errormessage if the window was not found in time

'

STW.wtUX|0|BCS - Testform|found

EXE.?exepfad\Sample Apps\BSC-Testform.exe

:found

 

' Now we can use the Application and press Buttons

' we use the following flags:

' w ... 0 - set waiting time to zero

' t ... "BCS - Testform" - caption of the window we are looking for

STW.wt|0|BCS - Testform

'

' We use the following flags in SCW.:

'

' "c" ... "Button" - window-class (its a button control)

' "t" ... "Cancel" - text on the button we search for

' "b" ... "backjump" is set to 120 ms

' "X" - Flag - no error if not found

' "w" - set waiting time to 5 seconds

SCW.ctbXw|Button|notthere|120|5

' Just move to the button, no click.

 

' We make another STW. or else the Backjump would go to the STW. in Line 34

STW.wt|0|BCS - Testform

' We set the backjump now to 1 second (=1000 ms)

SCW.ctbXw|Button|notthere|1000|5

 

' We make another STW. or else the Backjump would go to the STW. in Line 34

STW.wt|0|BCS - Testform

' We disable the backjump now

SCW.ctbXw|Button|notthere|0|5

 

MBX. Ready

'-----------------------------------------------------------

ENR.

 

 

 

Remarks

 

You can specify rollback times smaller then a second. Use in that case floating point notation, like "0.25".

 

 

Limitations:

 

 

 

 

See also:

 

    1. STW. - Decription

    SCW - Search-Child-Window

    3.2 Standard-Search Pattern