Identify process ID when starting program
The process identifier, normally referred to as the process ID or PID, is a unique decimal number used to uniquely identify an active process. This number may be treated as a parameter in various function calls to manipulate processes while automating desktop applications. That makes it much easier in complex use cases, when you need to know and save the ID of the process created by the open ('app.exe') command, for example, in order to detect all children of the opened application and perform some actions with them.
API
Integer pid = open("notepad.exe")
Integer pid = openAndFocus("notepad.exe", 1000, 100)
Description
- Works for desktop automation only.
- Returns null value for web drivers.
- Open method returns only parent process, child processes might exist in your case.
Examples
The feature can be used in combination with window filtering by process ID.
Expand to see the example
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
<robotics-flow>
<robot driver="universal">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="false"/>
</config>