Process Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Process Operations >

Process Commands

GDF. - Get-Data-From

Previous Top Next


MiniRobotLanguage (MRL)

 

GDF. Command

Get Data From

 

 

Intention

 

When your scripts get more advanced, then its time to understand this command.

Understanding how to use GDF. can add wings to your scripting abilities.

 

Be sure that you have read and understand the chapter about 1.7. Application and PID.

 

The most often used case for GDF. is to find out which process opened a window.

Here is  Sample Script that will show the executable behind the localized window,

 

STW.c|Chrome_WidgetWin_1

GDF.af|$$EXE

' Put Path in Clipboard

CLP.$$EXE

MBX.$$EXE

 

GDF. converts your scripting resources between each other. Just give it what you have, and you get what you need. Whatever you have, window handles, PID's or DLL names.

Feed it to GDF. and get what ever you need.

 

What is the EXE-Filepath od file with PID 123?

What is the PID of the Program that own the window we have localized?

What is the EXE-File-Path of the program that has the window handle number 12345?

What is the window handle of a program with PID 1234?

 

GDF. is the answer to all these questions. GDF. uses the prototype parameter system.

Be sure that you have read that chapter and understood how it works..

 

Imagine a box where you put in any information you have (PID, Path, handle ...) and you can get out any information you want. That is GDF.

 

GDF. deals with: Window-Handle, Process-ID and EXE-File-Path. The window handle must be a valid handle of an existing window. The file-path must be from an process or module (DLL) that is currently running. When asking for a DLL, the filename must end with ".dll". You can use the 3.2 Standard-Search Pattern for the filename on the source side. You can add a ">2" to the filename if you want the second fitting result.Of course any other number after the ">" will also do what you expect.

 

GDF. takes what you provide and calculates the rest you need. It can calculate multiple results at one time at the destination side. For example:

 

VAR.$$FIL=?exepath\MR01.exe

GDF.fph|$$FIL|$$PID|$$HWN

MBX.$$FIL - $$PID - $$HWN

ENR.

 

The first letter is always the source. Thats what you put in. All following letters in the prototype field are destination prototypes. In this example we have provided the "f" as source. We have given the filepath. ?exepath\ is  the 3.3 Specialfolders shortcut to the installation directory. Therefore $$FIL leads to the actual running robot itself.

This is what we put in. And the following two prototypes, these are "p" and "h" is what we expect to get back. "p" - is the Process ID (PID). And "h" is the window handle - or zero if the process has no window. For this we add two variables to be filled with these values.

$$PID for the PID and $$HWN for the window handle.

 

GDF. works with any process in the Task-Manager, no matter if that process has a window or not. If its running on a server OS, the program must start with sufficient rights to collect these information.

 

If you add prototypes and you do not give variables to put them in, the result will be placed on the actual stack.

 

If you want the PID from the actual localized window, you just write:

' We want the PID of the actual localized window(-prozess)

' into $$PID

GDF.ap|$$PID

 

 

' You can take a PID and localize a window with it!

: $$PID=1234

GDF.pa|$$PID

 

 

 

 

Syntax

 

 

GDF.P1|P2[|P3]..[|PX]

 

 

Parameter Explanation

 

Possible prototype-letters for source:

 

' a - the actual lokalized window is been used,

'     needs no input parameter therefore.

'

' f - filepath (Exe-Path or DLL Path), needs Parameter in source.

'     When used in source, you can add a ">" Sign to tell which of

'     many files with the same name you want.

'

' h - window handle (Child- or Top-Window), needs input parameter.

'

' p - Process ID (PID), needs input parameter.

'

' q - Process ID (PID) is taken from #pid#,

'     needs no parameter therefore.

 

 

Possible prototype-letters for destination:

 

' a - the window is been localized internally

'     like with SCW.h|$$HWN.

'

' f - filepath (Exe-Path or DLL Path). You can give a parameter

'     with a variable then the variable will be filled with

'     the filepath. If you omit the variable, the filepath is

'     been place on the actual stack.

'

' h - window handle (Child- or Top-Window), you can

'     give a parameter with a variable. In that case

'     the variable will be filled with the window handle.

'     If you omit the variable, the window handle

'     is been place on the actual stack.

'

' p - Process ID (PID), you can give a parameter with

'     a variable. In that case the variable will be filled

'     with the Process ID (PID). If you omit the variable,

'     the Process ID (PID) is been place on the actual stack.

'

' q - Process ID (PID) that is actually in #pid#, needs no

'     parameter. If used as destination, #pid# is set with

'     the result.

 

 

P1  - Prototype field. First letter is source prototype, all following letters are destination-prototypes

 

 

P2 ... PX - Input- and output variables according to prototype

 

 

 

 

 

Example

 

We'll look at some scenarios when using GDF. Think there are two application, named "x64.exe".We want the the PID's int two variables $$PIA and $$PIB.

To do this we need the information, that we can add a ">" Sign and a number behind a filename-parameter. This way we can decide which of multiple executable with the same name we want to get the PID for.

 

Lets go. Here is our Script.

 

graphic

 

and this is the result in the Editor-Debug Area:

 

 

graphic

 

We got the PID's of both executables. No matter that they had the same filename.

The [15] is from the DBP. command. It shows us that it was "Line 15" in the script that sent us this message. This information is useful for debugging. You will immediately know which DBP. sent you a message.

 

 

 

 

Remarks

 

x64 tested.

 

 

Limitations:

 

-

 

 

See also:

 

    1.7. Application and PID

    GPU. - Get Process User

    GPI. - Get Process Information

    IEP. / NEAP. - If-Exists-Process

    FEP. - For-Each-Process

    WPR. - Wait-Process-Running

    WPT. - Wait-Process-Termination

    3.3 Specialfolders