Parallel Robot Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Parallel-Robot Operations >

Parallel Robot Operations

PRR. - Parallel-Robot-Run

Previous Top Next


MiniRobotLanguage (MRL)

 

PRR. Command

Parallel Robot Run

 

 

Intention

 

The command PRR. can be used to start a parallel running robot. For this purpose it starts a block containing the script for the new robot. The PRE. command will end this script-block.

PRR. and PRE. must always be used in Pairs. They can be nested, a Parallel-Robot can start another parallel robot and so on.

 

graphic

 

This is the stack, after a successful call to PRR. / PRE.

At the top-level it contains the Window-Handle of the just started Robot.

Below is a valid "Ticket-Number" that can be used together with GRS. / WRS. / IRS. / PRS / JRS. etc..

 

 

Parameters:

Setting P1 to 0 (end or 1 (survive), tells the Parallel running robot if he should end, if his father dies, or if he should survive anyway. If you omit P1, the parallel-robot will also end, when the robot that started it, ends.

 

More Infos:

You can send variables to another running robot using PRV.

You can wait for a variable from another running robot using WFV.

Both of these may NOT work if the Robot runs on another Desktop.  

 

You can set a global Signal that multiple running Robots will see, using SGS. and check if such a signal exist, using IGS.

 
Here is an Sample that shows a Parallel-running Script on a "Private Desktop".

Please note that each PD has its own address space.

Therefore an Robot can not easily communicate with another Robot on a PD.

Several communications features may not work on a PD.

However the ! Smart Package Robot 's InterKOM Technology should work.

 

' This Script will create Desktop and start a

' new Script on that Desktop using the PRR.-Command

'

PDC.Create Desktop with Explorer|DTF

PDC.Switch to Desktop|DTF

PRR.0|DTF

 MBX.I am on the DTF-Desktop

 PDC.Goto Default

PRE.

MBX.End the Script

ENR.

 

 

Here is an Example that shows how you can wait for 5 Parallel Processes to end.

Click on the 5 Messageboxes and see what happens.

 

VAO.$$TIB=

FOR.§§LOP|1|5

' Run 5 Robots

  PRR.0

    MBX.!

    END.

  PRE.$$TIC
    ' Collect the Tickets separated with "," 

  $$TIB=$$TIB,$$TIC

NEX.

' Wait until they end

WRS.!$$TIB

ENR.

 

 

Syntax

 

PRR.[P1][|P2]

 

 

Parameter Explanation

 

P1 - (in) - 1/0 shall parallel-Robot survive when the

    starting robot ends?

 

P2 - (in/optional) - Name of the existing "Private Desktop" where the Script shall be started.

          if omitted, the Script will always start on the Desktop where the "Father-Script" is running.          
                   

 

 

Example

 

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

' PRR.-Sample

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

'

PRR.

 PAU.5

 KPN.TestApp_01.exe|a

 ENR.

PRE.

' EXB. - Beispiel

VAR.$$LNK=?exepath\Sample Apps\TestApp_01.exe

EXB.$$LNK

DBP.Exit-Code: $tos$

ENR.

 

 

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

' This script will create a Private Desktop

' and run a Script on that PD.
' It will use PRR. for this.
' Important: The Messagebox will appear on the PD!

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

GSB.Test

PDC.Create Desktop no Explorer|DTB

PRR.0|DTB

 GSB.Test

 ENR.

PRE.

MBX.!

ENR.

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

:Test

ICD.DTB

 MBX.Running on DTB.

ELS.

 MBX.Not running on DTB.

EIF.

RET.

ENR.

 

 

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

' PRR./PRE./WFV. - Sample 1

' Shows that the Parallel-Robot starts with

' all variables as they have been at starting-time

' of the starting robot.

' It can also use all Subroutines in this file.

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

VAR.$$INP=0

VAR.$$TXT=Peter

PRT. I am Robot-Nr. #pri# from #prc#.

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

PRR.

 PRT.I am Parallel-Robot-Nr. #pri# from #prc#.

 PRT.I am Son #pri# of $$TXT.

 DOL.1

   : $$INP=99

   PRT.Waiting for Variable

   GSB.wait

   PRT.Input=$$INP

   JIV.$$INP=0|out

   WFV.$$INP

   PRT. Variable set to: $$INP

   JIV.$$INP=0|out

 OOP.

 :out

 PRT.Parallelrobot Ending

 PAU.2

 END.

PRE.$$RET|0

PRT. I am Robot-Nr. #pri# from #prc#.

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

PAU.3

FOR.$$MYL|1|10

 GSB.wait

 VAN.$$INP=1.342587459

 PRV.$$RET|$$INP

NEX.

' END Paralel Robot

VAN.$$INP=0

PRV.$$RET|$$INP

PAU.8

DMP.

END.

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

:wait

PAU.0.1

RET.

 

 

Remarks

 

The Parallel-Robot starts with the full script. Therefore do not forget the END. before the PRE. Otherwise the Parallel robot will just walk over the PRE. into the Script of the starting robot.

Then both will try to do the same script at the same time. Depending on the Setting in the PRR. command,the parallel running robots will automatically be killed when the main-script that started the robot, ends.

 

 

 

Limitations:

 

It is possible to start more then one Parallel-running robot, actually up to 8.

 

Each robot uses quite some system resources/memory therefore you should not run too many, depending on your CPU number and memory capacity.

 

Each robot runs independently from the moment he starts with his script.

 

When using PRR. the Parallel-Robot will not inherit the e-Mail Configuration (for use with SMA.) from the Starting Robot. To send Mails in the Background, use SMB. instead.

 

 

 

See also:

 

    PRR. - Parallel-Robot-Run

    PRE. - Parallelrobot-Run-End

    PRV. - Parallel-Robot send Variable

    WFV. - Wait-For-VariableChange

    SGS - Set Global Signal (Mutex)

    WFM. - Wait-For-Message

    TWM. - Text-Window-Message