File Condition

See Also

 Setting a File Condition, About Conditions, All Available Conditions, Using AMTrigger, Using AMCondition

Description

The File condition is used to monitor one or more folders and starts a task/workflow based on files being added, removed, or modified. It can be set to watch all files in a folder or to watch for specific files or for size thresholds of files or folders. It can also be used to in the middle of a workflow as a "wait" object to wait for a file to be added, removed, or modified or determine the path of a workflow depending on whether a file has been added, removed, or modified.

NOTE: File conditions will work on network drives and shares only if the machine is part of a domain and if the computer AutoMate BPA Server 7 is running on has at least Read access to the folder being watched. The condition will not work on mapped drives or network shares that belong to a Win9x workgroup.

Practical Usage

Commonly used to monitor folders for "incoming files" When these files arrive, they are automatically processed ("processed" could be any combination of copying, reading, uploading etc).

Parameters

General Tab

Folder

Specifies the folder to monitor. Use the Folder button to navigate to the folder to be monitored or manually enter the full path to the desired folder in the field  provided.

 

Include Subfolders

If enabled, the Condition will search subfolders within the folder being monitored (disabled by default).

 

Wait for file to be accessible  

If enabled, the Condition will wait for files to be unused and fully accessible (or unlocked) before it becomes active. If disabled the Condition will become active even if files are in a locked state (disabled by default).

 

Polling interval for remote folders

Specifies the length of time that elapses before AutoMate checks for the specified condition (set to 10 seconds by default).

Prerequisites Tab

File Added

If enabled, specifies that the trigger will monitor for file(s) to be added to the monitored folder (enabled by default).

 

File Removed

If enabled, specifies that the trigger will monitor for file(s) to be removed from the monitored folder.

 

File Modified

If enabled, specifies that the trigger will monitor for file(s) from the monitored folder to be modified.

 

Number of files exceeds

The Condition will activate if the number of files in the monitored folder exceeds the amount entered.

 

One file size exceeds

The Condition will activate if a file in the monitored folder exceeds the amount entered in kilobytes.

 

Folder size exceeds

The Condition will activate if the total size of the folder being monitored exceeds the amount of kilobytes entered.

 

IMPORTANT: Selecting two or more of the above options will make the condition behave as an OR statement as opposed to an AND statement. In other words, execution starts upon the occurrence of any condition selected. For example, enabling the parameter File Added and entering 1 under the parameter Number of files exceeds will activate the condition when a file is added to the specified folder OR when the number of files in the specified folder exceeds the selected amount.    

 

Filters Tab

Include Mask

Specifies the filter(s) to be included in the search.

 

Exclude Mask

Specifies the filter(s) to be omitted from the search.

 

NOTE: Include and/or Exclude Masks can be filtered using a full path and filename or filename only. (i.e. C:\Temp\filename.txt or C:\Temp\*.txt or *.txt).

Additionally, multiple filters can be specified by using a vertical bar or pipe ("|") (i.e. C:\Temp\*.txt|*.jpg).

 

Behavior Tab

All available Conditions contain Behavior properties that dictate how it should handle a monitored event or condition. These properties determine whether the Condition should act as a trigger, a wait object or conditional (or decision making) object. By default, new Conditions are set to wait for the specified event/condition indefinitely, allowing it to act as a trigger object. For more details, see Condition Behavior.

User Tab

If the File Condition is monitoring a folder or file location on a network share or drive, or a location with restricted access rights, a user with rights to that share or drive is required. The following options are available:

 

No user required

Specifies that users with proper rights are not required to access the folder being monitored (default).

 

Use default Agent user

Specifies that the default user set for the Agent monitoring the folder will be used.

 

Use this user

Allows a user with proper rights to be entered in the following fields:

 

Default user name

The default user name can be either a plain user name (i.e. sparky), or a username/domain combination (i.e. sparky@networkautomation.com). When the latter form is used, the domain field is disabled.

 

Default password

The password to be used with the default user name specified above. This option can be blank if no password is associated with the selected user.

 

Default domain/machine name

The domain or machine name the user is a member of. This option can be left blank if the user is not a member of a domain or if there is only one workgroup for the machine.

These values are also used to replace the special fields of the Logon and Unlock Keystrokes used when logging on or unlocking a workstation. See the "See Also" section below for more information.

AMTrigger Parameters

When this trigger is activated, it automatically passes the "AMTrigger" object to the task. AMTrigger can be used within a task to determine whether or not the task was started by a trigger, which trigger started the task, when the trigger was activated and other trigger related properties. For more details, see

 

Common AMTrigger Fields

Every instance of AMTrigger populates a list of common fields which are described in the table below.

Name

Data Type

Return Value

AMTrigger.Trigger

String

Returns the name of the event or condition that triggered the task. Each event or condition contains a unique name. For this trigger, the value is always AMFILETRIGGER.

AMTrigger.TaskName

String

Returns the name of the managed task that the trigger was attached to. Useful to determine the responsible task when two managed tasks point to the same AML file.

AMTrigger.TriggerredDateTime

String

Returns the date and time when the trigger occurred.

AMTrigger.TriggeredOn

String

Returns the machine name where the trigger occurred.

AMTrigger.WasLocked

Boolean

If the workstation was locked when the trigger occurred, the value returned is 1. Otherwise, it will be 0.

AMTrigger.WasLoggedOff

Boolean

If the workstation was logged off when the trigger occurred, the value returned is 1. Otherwise, it will be 0.

AMTrigger.AML

String

Returns a verbose set of information about the triggered event or condition in AML (AutoMate Markup Language) format.

 

Exclusive AMTrigger Fields

The AMTrigger fields described in the table below are specific only to the Event Log condition.

Name

Data Type

Return Value

AMTrigger.Filename

 

Text

Returns the path and filename of the file that was added,modified or deleted (depending on the event settings) .

AMTrigger.Action

 

Text

Returns the action that took place to cause the condition to activate. The value can be one of the following:

  • FILE ADDED

  • FILE DELETED

  • FILE MODIFIED

  • TOO MANY FILES

  • ONE FILE TOO BIG

AMTrigger.Size

 

Number

If the AMTrigger.Action field returns "ONE FILE TOO BIG", this value is the size (in KB) of the file or folder that activated the trigger.

AMTrigger.NBFiles

 

Number

If the AMTrigger.Action field returns "TOO MANY FILES", this value is the total number of files in the directory being monitored.

 

AMCondition Parameters

When this condition is used in the middle of a workflow (as opposed to triggering condition) it automatically passes the AMCondition object to the task.

Common AMCondition Fields

Each condition contains its own set of unique AMCondition values. Therefore, the total number of fields that AMConditon creates during runtime and what they are called depend largely on the condition that was activated. However, every instance of AMCondition is populated with the following general fields:

Name

Data Type

Return Value

AMCondition.Agent

String

Returns the name of the agent where the condition activated.

AMCondition.DateTime

String

Returns the date and time of when the condition occurred.

AMCondition.Name
 

String

Returns the name of the activated condition. Each condition contains a unique name. For example, if the File condition was initiated, the value returned would be . See the help topic for each condition to determine that object's unique name.

AMCondition.Result
 

String

Returns the result of the activated condition (True or False).

AMCondition.WasLocked

Boolean

If the workstation was locked when the condition occurred, the value returned is 1. Otherwise, it will be 0.

AMCondition.WasLoggedOff

Boolean

If the workstation was logged off when the condition occurred, the value returned is 1. Otherwise, it will be 0.

AMCondition.AML

String

Returns verbose data about the activated condition in AutoMate Markup Language (AML) format.

 

Exclusive AMCondition Fields

The AMCondition fields described in the table below are specific only to the File condition.

 

Name

Data Type

Return Value

AMCondition.Filename

Text

Returns the path and filename of the file that was added,modified or deleted (depending on the event settings) .

AMCondition.Action

Text

Returns the action that took place to cause the condition to activate. The value can be one of the following:

  • FILE ADDED

  • FILE DELETED

  • FILE MODIFIED

  • TOO MANY FILES

  • ONE FILE TOO BIG

AMCondition.Size

 

Number

If the AMTrigger.Action field returns "ONE FILE TOO BIG", this value is the size (in KB) of the file or folder that activated the trigger.

AMCondition.NBFiles

 

Number

If the AMTrigger.Action field returns "TOO MANY FILES", this value is the total number of files in the directory being monitored.

 

NOTE: A full list of AMTrigger and AMCondition objects exclusive to each Event/Condition can be viewed from the Expression Builder by expanding the Objects folder and selecting the desired object from either the Triggers or Conditions folder .

See Also

About Events & Conditions

All Available Events & Conditions

Condition_Behavior