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.
Note: All If activities must be followed at some point with an End if step to mark the end of the code block that is to be executed if the expression is true. For ease of use, any If activity added to the Steps pane of the task builder is always followed by an End if activity.
Practical Usage
Commonly used to check if a particular process is running (or not) and performs conditional steps depending on the result.
General Parameters
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 Parameters
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. |
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
Datasets
A dataset is a multiple column, multiple row container object. This action creates and populates a dataset with the following fields (rows):
Name |
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.
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 ACTION="end" PROCESS="C:\Program Files\Internet Explorer\iexplore.exe" RESULTDATASET="ProcessDataset"> <AMSPEAK ENGINE="automatic">Process is not running </AMSPEAK> <AMELSE /> <AMSPEAK ENGINE="automatic">Process is running </AMSPEAK> </AMIF>