If - Process running |
Declaration
<AMIF ACTIVITY="process_running" DOMAINNAME="text" REMOTEMACHINE="text" USERNAME="text" PASSWORD="text (encrypted)" RESULTDATASET="text" ACTION="text (options)" PROCESSID="number" />
Description
Determines the state of a process and returns TRUE or FALSE depending on the outcome. If TRUE, the task will execute the block of steps immediately following this step up until an End if step is encountered. If FALSE, execution follows the next Else step, or End If step. Wildcards can be used to specify the process to evaluate. Optionally, this activity populates a dataset with multiple information about the specified process.
Practical Usage
Commonly used to check if a particular process is running (or not) and performs conditional steps depending on the result.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
If | Text (options) | Yes | Process is running |
| Specifies
the type of check to be performed. The available options are:
|
Find by name | Text | No | (Empty) |
| If enabled, specifies the executable of the process that should be evaluated. Partial matches are allowed (either the full path or the .EXE file alone can be specified). If this parameter is enabled, the Use Process ID parameter is ignored. |
Find by process ID | Number | No | (Empty) | PROCESSID="3648" | If enabled, specifies the process ID that corresponds to the process that should be evaluated. If this parameter is enabled, the Use Process Name parameter is ignored. |
Create and Populate Dataset | Text | No | (Empty) | RESULTDATASET="DatasetName" | The name of a dataset to be created and populated with process data for a running process. More information on the fields that this dataset creates can be found below under Datasets. |
Computer
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Local computer | --- | --- | --- | --- | If enabled, specifies that the process to evaluate resides on the local machine. This parameter is enabled by default. If this parameter is selected, the Another computer parameter becomes inactive. This is a visual mode parameter used during design time only, therefore, it contains no markups. |
Another computer | --- | --- | --- | --- | If enabled, specifies that the process to evaluate resides on a remote machine. The parameters below become active if this parameter is enabled. This is a visual mode parameter used during design time only, therefore, it contains no markups. |
Computer | Text | Yes | (Empty) |
| The host name or IP address of the remote machine that contains the process to evaluate. This parameter is available only if the Another computer parameter is enabled. |
Domain | Text | Yes | (Empty) | DOMAINNAME="netauto" | The domain name of the remote machine that contains the process to evaluate. This parameter is available only if the Another computer parameter is enabled. |
Username | Text | Yes | (Empty) | USERNAME="Bruce.Wayne" | A valid use name used to log onto the remote machine that contains the process to evaluate. This parameter is available only if the Another computer parameter is enabled. |
Password | Text | Yes | (Empty) | PASSWORD="batman" | The password corresponding to the username entered in the Username field. This parameter is available only if the Another computer parameter is enabled. |
Additional Notes
Datasets
A dataset is a multiple column, multiple row container object. This action creates and populates a dataset with the following fields (rows):
Name | Data Type | Return Value |
---|---|---|
theDataset.ProcessName | Text | Returns the path and file name of the process's .exe file. |
theDataset.ProcessID | Text | Returns the ID of the process. |
theDataset.WindowTitle | Text | Returns the title of the process's main window |
theDataset.WindowClass | Text | Returns the class of the process's main window. |
theDataset.WindowHandle | Number | Returns the handle of the process's main window. |
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
Simple task that checks if the Inter Explorer (iexplore.exe) process is running. If so, a Speak action speaks the text "Process is running." If not, a Speak action speaks the text "Process is not running."
<AMIF ACTIVITY="process_running" RESULTDATASET="ProcessDataset" PROCESS="C:\Program Files\Internet Explorer\iexplore.exe" />
<AMSPEECH TEXT="Process is not running" VOLUME="100" SPEED="50" />
<AMELSE />
<AMSPEECH TEXT="Process is running" VOLUME="100" SPEED="50" />
<AMIF ACTIVITY="end" />