File Pickup
The File Pickup message source type can be used to monitor a local folder on the ThinkAutomation computer. Each new or updated file found in the folder (and optionally sub-folders) will be passed to the Automation for processing. The Subject of the message will be set to the file path.
Select the From Folder and File Name or Mask. Enable the Include Sub-Folders option to also include sub-folders below the From Folder. The Mask can be a single mask (eg: *.pdf) or multiple masks separated by commas (eg: *.pdf, *.docx, *.txt). Leave the mask blank for all files.
Add File Contents
Enable the Add File Contents option if you want ThinkAutomation to add the file contents to the message passed to ThinkAutomation for processing. Text based files will be added as the plain text body. HTML files will be added as the HTML body. Any other files will be passed as an Attachment - which you can then process in the Automation. The Add File Contents option applies only to files less than 50MB in size. For files greater than 50MB the file details will be passed (see below).
Add File Contents - Email Messages
Files with extensions .eml and .msg (Outlook Messages) will be added as regular email messages (with Body, Subject, From, To, Headers etc set.).
No File Contents
If Add File Contents is not enabled (or the file size > 50MB) then only the file details will be passed to the Automation. The file details are passed as Json in the Message Body, in the following format:
{
"Path": "D:\\Setup Files\\ThinkAutomation.exe",
"Name": "ThinkAutomation.exe",
"Extension": "exe",
"Size": 167815264,
"Created": "2020-11-20 14:58:02",
"Modified": "2020-11-20 14:58:05",
"Description": "ThinkAutomation Installer",
"CompanyName": "Parker Software",
"Version": "5.0.261.2",
"Product": "ThinkAutomation"
}
The Subject will be set to the file path.
In an Automation you can then access the file path using %Msg.Subject% and extract other file information using Extract Field actions. The default Automation created when you create the Message Source will automatically contain Extract Field actions to extract the above fields. You can then use the %Path% variable on Automation actions (such as Convert Document, Print etc).
Delete After Pickup
Enable the Delete After Pickup option if you want ThinkAutomation to delete files once they have been processed.
Enable Folder Monitoring
If the Enable Folder Monitoring option is enabled then ThinkAutomation will monitor the selected Folder for new or changed files (after the initial scan). New and changed files will be processed immediately. If this option is not enabled then you can set a Schedule (for example: Every 2 minutes). The folder will scanned depending on the schedule - and any new files will be processed. Folder monitoring is enabled by default - you can disable it if you only want to scan a folder at pre-set times.
CSV and Excel Files
When using the File Pickup message source type, CSV and Excel files can be treated differently. Instead of the complete file, ThinkAutomation can select any new Rows added to the CSV or Excel file and send these as single messages to the Automation for processing.
For Example, consider the following CSV file:
| Product | Name | Quantity | Value |
|---|---|---|---|
| Item 1 | Item 1 description | 100 | 1.20 |
| Item 2 | Item 2 description | 200 | 1.30 |
When ThinkAutomation reads this CSV file (or Excel file) it will create 2 messages in the following format:
Message 1:
{
"xName": "items.csv",
"xRow": 1,
"Product": "Item 1",
"Name": "Item 1 description",
"Quantity": 100,
"Value": 1.20
}
Message 2:
{
"xName": "items.csv",
"xRow": 2,
"Product": "Item 2",
"Name": "Item 2 description",
"Quantity": 200,
"Value": 1.30
}
The subject of the message will be: [filename] Row x
Enable the For CSV & Excel Files Create Single Messages For Each New Row option to enable single row message processing. For Excel files you can also optionally specify the Worksheet name to use and the Headers Row number containing header values.
For CSV files, if the CSV file has no header row, enable the CSV Has No Header Row option.
By default all columns in the CSV or Excel file will be passed to the Automation. If you only need certain column values enable the Read Values From Specific Columns option and then specify a list of Column Headers or Column Numbers.
Creating Extracted Fields For CSV & Excel Files
When using single row processing ThinkAutomation can create the Extract Field actions for you. Click the Create Extracted Fields button. ThinkAutomation will then read the CSV or Excel file specified in the File Name entry and create an Extract Field action for each column.
Resetting The Last Row Pointer
Each time ThinkAutomation reads the CSV or Excel file for new rows, it stores the last row number in the Message Store database, so only new rows since the last scan are processed. During testing you may need to reset this to allow a new full scan. To reset the pointer, click the Reset Last Rows button.