Wait - For process

Declaration

<AMWAIT ACTIVITY="pointer" ACTION="text (options)" POINTER="text (options)" />

Related Topics    

Description

Causes task execution to pause at the current step until the specified process starts or ends. Optionally, a dataset can be populated with information about that process (for example, process name or unique ID).

Practical usage

Commonly used to wait for an external application to start or end, which could indicate that a process has completed successfully. If the process started / ended then the task could progress.

Parameters

General

Property Type Required Default Markup Description
Wait until Text (options) Yes Match
  1. PROCESSACTION="end"
  2. PROCESSACTION="start"
Specifies the process condition to wait for before proceeding to the next step. The available options are:
  • Process is running - Wait until the process is  running before continuing. This activity will act on the process if it is already running upon reaching this step.
  • Process is not running - Wait until the process is not running before continuing. This activity will act on the process if it is no longer running upon reaching this step.
Find by name Text No (Empty)
  1. PROCESS="c:\folder\iexplore.exe"
  2. PROCESS="iexplore.exe"
If enabled, specifies the executable name of the process to wait for. This parameter supports wildcard characters (that is, * or ?) to denote partial matches. Either the full path and file name (for example, c:\folderName\processName.exe) or the file name only (for example, processName.exe) may be specified. If the Find by process ID parameter is enabled, this parameter is ignored.
Find by process ID Number No (Empty) PROCESSID="3932" If enabled, specifies the process ID of the process to wait for. If the Find by process name parameter is enabled, this parameter is ignored.
Create and populate dataset Text No (Empty) RESULTDATASET="DatasetName" The name of the dataset to be created and populated with information about the process. More on the fields that this dataset creates can be found below under Datasets.

Description

Error Causes

On Error

Additional notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name Type Return Value
theDataset.ProcessName Text Returns the path and file name of the process's .exe file.
theDataset.ProcessID Number 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.

Examples

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Example 1

Wait for Internet Explorer process to start.

Copy
<AMWAIT ACTIVITY="process" RESULTDATASET="theDataset" PROCESS="C:\Program Files (x86)\Internet Explorer\iexplore.exe" />

Example 2

Wait for Internet Explorer process to end.

Copy
<AMWAIT ACTIVITY="process" RESULTDATASET="theDataset" PROCESSACTION="end" PROCESS="C:\Program Files (x86)\Internet Explorer\iexplore.exe" />