<< Click to Display Table of Contents >> Navigation: 3. Script Language > Process Operations > Process Commands |
MiniRobotLanguage (MRL)
FPI. Command
File-Path to PID and reverse
Intention
If you specify a File-path, the command will give you the corresponding PID.
VAR.$$FIL=?exepath\Sample Apps\TestApp_01.exe
FPI.$$FIL|$$PID
DBP.PID is:$$PID
You can provide a File-path or not. And just specify a filename. In all cases, you can use 3.2 Standard-Search Pattern, see this valid example:
VAR.$$FIL=Testapp&AND:01.exe
FPI.$$FIL|$$PID
DBP.$$PID
ENR.
In case you prefer to use the good old WIldcards, * and ?, do it like this:
VAR.$$FIL=&WILDC:Testapp*01.exe
FPI.$$FIL|$$PID
DBP.$$PID
ENR.
If there are multiple Instances of this program running, you can additionally specify a Instance number:
VAR.$$FIL=?exepath\Sample Apps\TestApp_01.exe
' Will get the PID of the second Instance of that program
FPI.$$FIL|2|$$PID
DBP.PID is:$$PID
You can also go the opposite direction and get the File-Path of a PID. Like this:
STW.ct|PBWindowClass:0|TestApp
SCW.nct|1|Static|This is a Text in the TestApp.
VAR.$$PID=#pid#
FPI.>$$PID|$$FIL
DBP.$$FIL
ENR.
This example will Print the Path to the Sample Application.
Note: This command duplicates a function from GDF. We made this as extra command, to make working with processes easier to use and understand.
Syntax
FPI.P1[|P2][|P3]
Parameter Explanation
P1 - Filename (with or without path). If it starts with a ">" then
a numeric PID must follow. You can use variables and also a
formula in (..).
P2 - (optional) Variable for the result, if two parameters are
specified. If three parameters are given, this is the
number of the executable to search for, and P3 is the
variable for the result.
P3 - (optional) Variable for the result.
Example
'***********************************
' FPI.-Demo
'***********************************
' STW. will automatically set #pid#
' to the PID of the program that created the window.
STW.ct|PBWindowClass:0|TestApp
SCW.nct|1|Static|This is a Text in the TestApp.
VAR.$$PID=#pid#
' Get the Path of a program
FPI.>$$PID|$$FIL
DBP.$$FIL
ENR.
Remarks
-
Limitations:
-
See also:
• GPI. - Get Process Information
• IEP. / NEP. - If-Exists-Process
• WPT. - Wait-Process-Termination