Wait - For process

Declaration

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

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 (such as process name or 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

ACTION="start"

Specifies the process condition to wait for. The available options are:

  • Process is running - Wait until the process is in a 'Running' state. If the process is already running upon execution of this step,

  • Process is not running - Wait until the process is not in a running state.

Note: If the specified condition amounts to TRUE upon execution of this step, it will not

Use Process Name

Text

No

(Empty)

  1. PROCESS="c:\folder\iexplore.exe"

  2. PROCESS="iexplore.exe"

The executable of the process that should wait for. Partial matches are allowed (either the full path or the EXE name only may be specified).

Note: The process may be specified either by process name or by process ID—see below.

Use Process ID

Number

No

(Empty)

PROCESSID="3932"

The process ID of the process that should wait for.

NOTE: The process may be specified either by process name or by process ID.

Create and populate dataset

Text

No

(Empty)

RESULTDATASET="DatasetName"

The name of a dataset to be created and populated with process data. More on the fields that this dataset creates can be found below under Datasets.

Description

Error Causes

On Error

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: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Sample 1: Wait for Internet Explorer process to start.

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

Sample 2: Wait for Internet Explorer process to end.

<AMWAITFORPROCESS ACTION="end" PROCESS="C:\Program Files (x86)\Internet Explorer\iexplore.exe" RESULTDATASET="theDataset" />