Wait for File Action

Declaration

<AMWAITFORFILE ACTION="text [options]" FILE="text" EXCLUDE="text" ISNEWERTHAN="datetime" ISOLDERTHAN=datetime INUSE="yes/no" RESULTVARIABLE="text">

See Also

Wait for Pointer, Wait for Pixel, Wait for Window, Wait for Process, Close Window

Description

Causes task execution to pause at the current line until the specified file is found to exist or not exist.

Practical Usage

Commonly used to wait for a (external application generated) file to exist or not exist that would indicate process has completed successfully. If the file appeared/disappeared then the task could move on - otherwise it should fail. 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 file was done being downloaded before performing further processing.

Parameters

General Tab

Action
Text [options], optional - default - "exists"
MARKUP: ACTION="differ"

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

The available options are:

exists: Wait until the file exists (or is created) .

not_exists: Wait until the file does not exist (or is deleted).

changed: Wait until the file is changed (or modified).

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

Specifies the filename that AutoMate should wait for.

Wait until file is not in use
Text, Required
MARKUP: FILE="c:\foldername\filnametowaitfor.txt"

Specifies the step should not stop waiting until the file has not only met the condition but is also no longer in use. This option is useful to insure that the step does not move on until the file is done being transferred/written to the folder specified.

Populate Filename into Variable
Text, Optional - Default - (blank)
MARKUP: RESULTVARIABLE="myvarname"

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 wildcards are used in the File parameter so that the file itself may be referenced in later steps.

Exclude Mask
Text, Optional default - (blank)
MARKUP: EXCLUDE="*.txt"

Causes the action to not wait for files matching the mask(s) specified. Filenames or wildcard ( e.g. * or ? ) masks may be used, multiple entries may be specified by separating them with the | symbol (e.g. *.txt|*.bak)

Only if newer than
date, Optional default - (none)
MARKUP: ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only wait for file(s) if the source is newer than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding "Only if newer" [ISNEWER] parameter).

Only if older than
date, Optional default - (none)
MARKUP: ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only wait for file(s) if the source is older than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding "Only if newer" [ISNEWER] parameter).

Notes

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 by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, a popup expression builder is available in all these fields by pressing F2.
More on variables...
More on expressions...
More on the expression builder...

Example