If - Process running

Declaration

<AMIF ACTIVITY="process_running" DOMAINNAME="text" REMOTEMACHINE="text" USERNAME="text" PASSWORD="text (encrypted)" RESULTDATASET="text" ACTION="text (options)" PROCESSID="number" />

Related Topics   

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, by default, any If activity added to the Task Builder's Steps panel 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.

Parameters

General

 
PropertyTypeRequiredDefaultMarkupDescription
IfText (options)YesProcess is running
  • ACTION="running"
  • ACTION="end"
Specifies the type of check to be performed. The available options are:
  • Process is running - The If block will be executed if the process is running.
  • Process is not running - The If block will be executed if the process is not running.
Find by nameTextNo(Empty)
  • PROCESS="c:\folder\iexplore.exe"
  • PROCESS="iexplore.exe"
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 IDNumberNo(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 DatasetTextNo(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

 
PropertyTypeRequiredDefaultMarkupDescription
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.
ComputerTextYes(Empty)
  • REMOTEMACHINE="machine.domain.com"
  • REMOTEMACHINE="xxx.xxx.xxx.xxx"
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.
DomainTextYes(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.
UsernameTextYes(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.
PasswordTextYes(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

Error Causes

On Error

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):

 
NameData TypeReturn Value
theDataset.ProcessNameTextReturns the path and file name of the process's .exe file.
theDataset.ProcessIDTextReturns the ID of the process.
theDataset.WindowTitleTextReturns the title of the process's main window
theDataset.WindowClassTextReturns the class of the process's main window.
theDataset.WindowHandleNumberReturns the handle of the process's main window.

Example

NOTE:
  • 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."

Copy
<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" />