The File System Trigger will trigger an AutoMate Task when there is a change on the computer's file system.
To use the File System Trigger, perform the following steps
First Create a new task, when selecting the trigger to use, choose "File System"
Enter the name of the folder to be monitored in the "To Monitor" field of the File System trigger properties.
The File System Trigger has the option to trigger when changes take place inside the sub-folders of the folder that was specified in the "To Monitor" field. To activate this capability, check the "Watch Sub Directories checkbox". (For example, if an AutoMate task is to be triggered when a file is added to "c:\MyDir" and the "Watch Sub Directories" checkbox is checked, AutoMate will trigger when a file is added to "c:\MyDir\Some SubDir" as well as when a file is added to “c:\MyDir.”)
The File System Trigger can be configured to "monitor" as well as "ignore" certain types of files. This is specified in the "Masks" tab. Enter the types of file that the File System Trigger should monitor in the "Include" field. If the "Include" field is blank, all files (*.*) is assumed. Specific files or file masks can also be entered in this field; for example, the File System Trigger may be configued to monitor for "MyFile.txt" or "*.txt". To add more than one file mask or types of files in the "Include" field, just separate the masks with semicolons. (For example: "*.zip;*.doc;MyFile.txt". This will include all zip files, all doc files and a file named "MyFile.txt". No other files will cause this particular task to trigger.) NOTE: Files entered in the "Exclude" will be ignored by the File System Trigger. If the "Exclude" field is left blank, no file is excluded. For example, if "*.zip;*.doc;MyFile.txt" is entered in the "Exclude" field, the File System Trigger will ignore all zip files, all doc files and a file named "MyFile.txt". All other files will cause this to trigger. The Exclude masks take precedence over the Include masks. Therefore if "*.zip" is entered in the "Include" field and "MyFile.zip" is entered in the "Exclude" field, then MyFile.zip will NOT cause the task to trigger. On the other hand if MyFile.zip is entered into the "Include" field and "*.zip" is entered into the "Exclude" field, then NO zip file will cause the task to trigger.
The File System Trigger can be set to monitor for particular events that take place on a folder, namely adding, removing or deleting a file, and monitoring the size of all files, the size of one file, or the number of files in a folder. These options are set in the “Monitor Types” and “Monitor Sizes” tabs respectively.
The last option on the File System trigger is "Interval" . This option sets the amount of time that AutoMate will wait before triggering this task again.
NOTE: There is a special case with "File Removed" on Windows NT. When a specific folder is monitored with sub-folders included, AutoMate wil NOT trigger the task if a sub-folder in the "monitored folder" is highlighted and deleted. This is the nature of the Windows NT file system.
Trigger Parameters
Once the task is triggered, retrieving information about the files
system changes that triggered your task is often a requirement,
especially if you need to process (e.g. upload, copy, delete etc )
the file(s) that has/have been modified and/or added to a given folder.
When a the file system trigger starts a task, one or more AutoMate variables are automatically created and passed to the triggered task. These “auto-defined” variables can be used to examine which type of change took place, what the filename was that triggered the task, and more. The values of the TRIGPARAMX variables differ depending on the options you selecetd in the file system trigger.
The following chart below specifies what each File System Trigger event populated these variables with:
File Added |
File Removed |
File Modified |
File Count |
Folder Size |
File Size |
|
TRIGPARAM1 |
returns 0 |
returns 1 |
returns 2 |
returns 3 |
returns 4 |
returns 5 |
TRIGPARAM2 |
full folder name and filename of the file added |
full folder name and filename of the file removed |
full folder name and filename of the file modified |
folder being monitored |
folder being monitored |
full filename of the file being monitored |
TRIGPARAM3 |
folder name of the file added |
folder name of the file removed |
folder name of the file modified |
new number of files in the folder |
new size of the folder |
folder of the file being monitored |
TRIGPARAM4 |
filename of the file added |
filename of the file removed |
filename of the file modified |
n/a |
n/a |
filename of the file monitored |
TRIGPARAM5 |
n/a |
n/a |
n/a |
n/a |
n/a |
new size of the file |
TRIGPARAM1 returns the type of event that caused the File System trigger to fire. If you have multiple options selected on the File System Trigger - this value is especially important as it will help you determine what to expect in the rest of the trigger parameters.
The values of TRIGPARAM1 can be as follows.
0 = File added
1= File removed
2 = File modified
3 = File count over specified size
4= Folder size over specified size
5= File size over specified size
Using the trigger parameters in your task
Since trigger parameters are really just "auto-created" variables, using them in your task is the same as using a variable. Simply enclose the value with exclamation point pairs (!!). Upon running the task AutoMate will resolve the value into the proper trigger paramter.
For example, this step moves all the files that are triggered by the File System trigger to a folder called "processed" and gives them the same file name.
MOVE: "!!TRIGPARAM2!!","c:\processed\!!TRIGPARAM4!!"
(TRIGPARAM2 gives us the full foldername and file name and TRIGPARAM4 gives us just the file name which we append on to the end of the destination folder)
See Also: