File watcher and email attachments

Let us assume that once a week a report file is put into C:\Reports\ folder in Adobe Acrobat .pdf format. In contrary to other file types copied into C:\Reports\ folder, all .pdf reports have to be sent over email immediately for preliminary review.

As we can see, the Task at hand involves two operations. First, we need to watch files of particular type, namely, files .pdf extension. And, second, whenever file watcher detects such a file in C:\Reports\ folder, it needs to send an email with the watched file in attachment.

This tutorial will demonstrate how to create a Task and add necessary Triggers and Actions to constantly watch files and automatically send emails.

How to create a Task? Let us begin with creating a Task. Click New Task in File menu of Automation Workshop. Alternatively, click right mouse button within Task pane and choose the New task option from context menu or push Ctrl+N keyboard shortcut while Automation Workshop manager window is active. Either way, it will open the Task Wizard, an advanced tool for Task creation.

How to add a file watcher? In order to watch files in folder C:\Reports\ we will need to add a file watcher. In Automation Workshop file watcher functions are included in a trigger called File / Folder Watcher. When in Task Wizard, click Next to go to the Triggers tab. Push Add button (this will open Add Trigger window) and choose File / Folder Watcher from the list. Click OK to open its setup (File / Folder Watcher Folder tab).

How to configure the file watcher? First we will need to watch files as they appear in particular folder. Click Browse button and choose C:\Reports\ folder. File watcher will watch files only in this folder (and, optionally, also its subfolders).

File / folder watcher - monitor Report's folder

Second, when watching files in C:\Report\ folder, we only need to execute the Task when the file watcher detects a file matching our criteria. And since we are specifically looking for all Adobe Acrobat files (files with .pdf extension), we need to use a filter. Go to Filter tab of File / Folder Watcher. We will need to use Include mask to watch files with specific extension. The proper mask for all PDF files is *.pdf (see info on file masks). This way file watcher will automatically exclude other files that do not conform to specified naming scheme (i.e., all files that do not have .pdf extension).

File / folder watcher - include all .pdf files

Now, after file watcher, let us configure the email sending part of the Task. Click OK to save File / Folder Watcher configuration and return to Task Wizard.

How to add and configure email sending with watched file in attachment? First we need to add appropriate Action. Click Next to go to Actions tab of Task Wizard. Push Add button to open the list of available Actions (this will open Add Action window). Choose Send Email Action from Email category and click OK to open its email properties.

After entering sender's (From) and recipient's (To) addresses as well as email subject and text, we need to attach the file watched by File / Folder Watcher Trigger. Put cursor into the Attachments field and click on Variable Wizard button. In this case we need to tell Send email Action to attach the file which has triggered the File / Folder Watcher. In other words, we need to take Attachment field parameter from the File / Folder Watcher Trigger. Select File / Folder Watcher in Trigger category and use the default preset Full path and filename. Click OK and see that the Attachment field contains Filename variable. It means that each time the Send Email Action tries to send an email, it will automatically attach the file the very appearance of which in C:\Reports\ folder initiated the Task. Click OK to save the Action and return to Task Wizard.

Send automated email with .pdf attachment

Finalizing the Task. After adding Send Email Action, we still have to check Run As settings, setup Reports for both successful Task execution and failure as well as give Task a custom name and description.

We've just created a Task that contains File / Folder Watcher trigger and Send Email action. File / Folder Watcher is configured to watch C:\Reports\ folder and execute the Task as soon as a new .pdf file appears in it. When executed, the Task performs the Send Email action. Send Email action requests the path and file name of the watched file (i.e., the file appearance of which initiated the Task itself) from the File / Folder Watcher trigger. Then Send Email action sends email to specified address with the watched file in attachment. The Task successfully finishes and is only triggered again when another new .pdf file appears in C:\Reports\ folder.

Free trial 15 day trial · Details…
Buy now 30 day MBG · Details…

If you have any questions, please do not hesitate to contact our support team.

© 2001–2017 Febooti Ltd.