Wait for File Action

Description

Causes Workflow 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.

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 Workflow 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.

Declaration

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

Example

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

General Tab Parameters

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

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

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

  • Wait until file has changed: wait until the file is changed.

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

File: Specifies the file name that Automated Workflow should wait for.

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

Wait until file is not in use: 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 Workflow does not continue until a file is done being transferred or written to a folder.

Yes/No, Optional, Default: "YES"
MARKUP: INUSE="NO"

Populate filename into variable: 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.

Text, Optional
MARKUP: RESULTVARIABLE="myvarname"

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

  • Name: the name of the file

  • Size: the file size

  • CreatedOn: the file creation date

  • ModifiedOn: the date the file was last modified

  • AccessedOn: the date the file was last accessed

  • IsFolder: yes/no—name is a folder  

  • IsReadOnly: yes/no—read-only attribute

  • IsArchive: yes/no—archive attribute

  • IsSystem: yes/no—system attribute

  • IsHidden: yes/no—hidden attribute

  • IsCompressed: yes/no—compressed

  • IsAccessible: yes/no—accessible

Text, Optional
MARKUP: RESULTDATASET="DatasetName"

Options Tab Parameters

Exclude mask: 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

Text, Optional, Default: (blank)
MARKUP: EXCLUDE="*.txt"

Only if newer than: 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).

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

Only if older than: 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).

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

Attributes Tab Parameters

Attributes: 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 is 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:

  • R—Read-only: Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included; not specifying the letter (default) causes this attribute to be ignored.

  • A—Archive: Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included; not specifying the letter (default) causes this attribute to be ignored.

  • S—System: Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included; not specifying the letter (default) causes this attribute to be ignored.

  • H—Hidden: Specifying "+H" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included; not specifying the letter (default) causes this attribute to be ignored.

  • C—Compression: Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included; not specifying the letter (default) causes this attribute to be ignored.

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