<< Click to Display Table of Contents >> Navigation: 3. Script Language > Execute-Commands > Execution Commands |
MiniRobotLanguage (MRL)
EXA. Command
Execute Asyncron
Intention
EXA. can be used to start executable files, non-blocking*. The command will not wait until the process is started. Therefore EXA. is very fast.
Usage is as simple as:
EXA.?exepath\Sample Apps\TestApp_01.exe
If you use EXA., internally a background process will be started to do the job. This background process will:
1. Set the given variable - if any - to zero
2. start the executable
3. wait for it to run
4. assign the PID to the given variable if there is any. This can happen at any time later.
Therefore the PID may not be available immediately after the command. As this depends on the target process, there is no warranty when/if the PID will be available.
As the given PID-variable (P2) will be set to zero at the start of the EXA.-command, you can wait for the PID to become available in case you need that.
EXA. itself can not be blocked and that is its strong side. Internally its as fast as EXF.
It may deliver the PID if you give a variable.
Special Mode: Stack-Variable as P2
If you give a stack variable ($$000 for example) as P2 then the script assumes that a real variable name is been placed on the stack before and will try to resolve the stack for that variable. If that is successful, this real variable will get the PID when its available. If that fails because there is no variable-name on the stack, the result is been placed in the given stack variable.
*The term "non-blocking" means that the command will never block the script from further execution. The script will continue with execution no matter what sort of executable has been started.
Syntax
EXA.P1[|P2]
Parameter Explanation
P1 - Document-Filename (can be a hyperlink)
P2 - (optional) Variable that will be filled with PID of the
started process. Important: This happens at ANY TIME later.
If omitted, PID is been dropped (NOT placed on TOS,
NOT put into #pid#).
P3 - (optional) Window Size Parameter
You can use the following window-size parameters for P2
0 - HIDE - Hides the window and activates another window.
1 - SHOW NORMAL Activates and displays a window.
2 - SHOW MINIMIZED - Activates the window and displays it as a
minimized window.
3 - MAXIMIZE - Maximizes the specified window.
4 - SHOW-NO-ACTIVATE - Displays a window in its
most recent Size and position.
The active window remains active.
5 - SHOW - Activates the window and displays it
in its current size and position.
6 - MINIMIZE - Minimizes the specified window and
activates the next top-level window in the Z order.
7 - SHOW-MIN-NO-ACTIVE - Displays the window as
a minimized window. The active window remains active.
8 - SHOW-NO-ACTIVE - Displays the window in its current state.
The active window remains active.
9 - RESTORE - Activates and displays the window.
10 - SHOW-DEFAULT - Sets the SHOW STATE to default.
Example
'***********************************************
' Example 1 - without Windows-Parameter
'***********************************************
VAR.$$LNK=?exepath\Sample Apps\TestApp_01.exe
FOR.$$CNT|1|5
EXA.$$LNK|$$PID
DBP.$$PID
NEX.
PAU.10
KPN.TestApp|a
MBX.Ready!
ENR.
'***********************************************
' Example 2 - using Windows-Parameter
'***********************************************
VAR.$$LNK=?exepath\Sample Apps\TestApp_01.exe
FOR.$$CNT|1|5
' Start them minimized
EXA.$$LNK|$$PID|6
DBP.$$PID
NEX.
PAU.10
KPN.TestApp|a
MBX.Ready!
ENR.
'**********************************************
'***********************************************
' Example 3 - Wait for PID to appear
'***********************************************
KPN.TestApp|a
VAR.$$LNK=?exepath\Sample Apps\TestApp_01.exe
FOR.$$CNT|1|15
EXA.$$LNK|$$PID|1
:Loop
PAU..1
JIZ.$$PID|Loop
PRT.$$PID
NEX.
PAU.20
KPN.TestApp|a
MBX.Ready!
ENR.
Remarks
Technical remark: EXA. uses multithreaded asynchronous Shell- / Create-Process-Technology and is compatible with other commands that use this technology.
Limitations:
-
See also:
• EXO. - Execute Open Document
• IEF. / NEF. - If - exist - File
• IEP. / NEP. - If-Exists-Process