Wait for File Action



See Also

Wait for File Action-Setting Properties, Wait for Pointer, Wait for Pixel, Wait for Window, Wait for Process, Close Window


Causes task execution to pause at the current line until the specified file meets the specified condition. The action can wait for the file to exist, not exist, or change.

Practical Usage

Commonly used to wait for a file generated by an external application to exist or not exist, indicating a process has completed successfully. If the file appears or disappears then the task can move on; otherwise it fails. For example if automating a file download process, after the keystrokes are sent to start the file download, the Wait for File action could be used to wait until the download finishes before performing further steps.


General Tab


Text [options], Optional, Default: "exists"
MARKUP: ACTION="not_exist"

Specifies whether to wait for the file to appear, disappear, or change.

The available options are:


Text, Required
MARKUP: FILE="c:\foldername\filnametowaitfor.txt"

Specifies the file name that AutoMate should wait for.

Wait Until File is Not in Use

Yes/No, Optional, Default: "YES"

Specifies the step should continue waiting until the file has not only met the condition but is also no longer in use. This option is useful to ensure, for example,  that the task does not continue until a file is done being transferred or written to a folder.

Populate Filename into Variable

Text, Optional

Specifies the name of an already created variable that should be populated by the file name that caused the step to continue. This is especially useful if wildcard characters are used in the File parameter so that the file itself may be referenced in later steps.

Create and Populate Dataset

Text, Optional

Specifies the name of a dataset to be created and populated with the file data for the file that caused the task to continue. In addition to the standard dataset fields, the dataset will contain the following:

Options Tab

Exclude Mask

Text, Optional, Default: (blank)

Causes the action not to wait for files matching the masks specified. File names or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (|), for example: *.txt|*.bak

Only if Newer Than

Date, Optional, Default: (none)
MARKUP: ISNEWERTHAN="%DateSerial(2007,02,01) + TimeSerial(00,00,00)%"

Causes the action to wait only for files newer than the date/time specified. If this parameter is left blank or not included, the date of the files will be ignored (unless limited by the Only if older than [ISOLDERTHAN] parameter).

Only if Older Than

Date, Optional, Default: (none)
MARKUP: ISOLDERTHAN="%DateSerial(2007,02,01) + TimeSerial(00,00,00)%"

Causes the action to wait only for files older than the date/time specified. If this parameter is left blank or not included, the date of the files will be ignored (unless limited by the Only if newer than [ISNEWERTHAN] parameter).

Attributes Tab


Text, Optional, Default: (blank)
ATTRFILTER="+R+A-S-H" (wait for read-only and archive files, not system or hidden)
ATTRFILTER="-S" (do not wait for "system" files)

This group of settings causes the action to filter which files to wait for based on the attribute settings of the source files.

In visual mode, a group of controls are provided to assist in the selection of this parameter. In markup mode, a single text item must be specified that contains the attributes of the files you wish to wait for.

Available Options:


Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder


NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMWAITFORFILE ACTION="not_exist" FILE="C:\FolderName\*.*" EXCLUDE="*.xml" ISNEWERTHAN="%DateSerial(2007,01,01) + TimeSerial(13,58,36)%" ISOLDERTHAN="%DateSerial(2007,02,27) + TimeSerial(13,58,36)%" RESULTVARIABLE="VariableName1" RESULTDATASET="DatasetName" ATTRFILTER="-r" />