Situation. Let us suppose that
.jpg image files are routinely uploaded to network share located on a machine running Automation Workshop. Every 90 minutes we would like to send all
.jpg files to particular email address and erase them from
C:\Share\ folder afterward.
Solution. Let us break down Task's design into its few basic elements.
First of all, in case of any Task, we need to understand when and why it is executed. In other words we have to give account on conditions of its execution. This time the Task is to be executed periodically, once per every 90 minutes. The appropriate Trigger for time based Task execution is Task Scheduler.
It would seem that we need to configure Send Email Action to send email to specified address and use wildcards to specify all
.jpg files to be attached to email message. However, considering that the images are erased afterwards, there is a little risk of the following scenario:
fax.jpg) is copied into
C:\Share\after the Send Email action has started to send email (
fax.jpgin this case) will be erased without being sent at the first place.
In order to avoid such a scenario, the Task should be designed in a slightly different manner. Let us consider that the images before being sent are moved to another folder
C:\Outbox\ and only after that attached to email message, sent and erased. It would result in the following:
C:\Share\it is not relevant for Delete File action that, upon completion of email operations, erases all
The second step, thus, consists of configuring the Move File Action to move all
.jpg files from
C:\Outbox\ folder. In order to specify all
.jpg files, appropriate wildcard will be used.
In the third step we will use the Send Email Action to send email to specified address. We will also use the path and wildcards to specify attachment files.
Finally, we will use wildcards to specify which files will be erased upon execution of Delete File Action.
How to create a new Task? Open Automation Workshop manager and choose the New Task… option in the File menu (keyboard shortcut Ctrl+N). Also accessible with right mouse click in Task pane. It will open Task Wizard which will lead us through Task creation process.
How to add Task Scheduler trigger? After reading the Welcome screen click Next to get to the Triggers tab. Once there, click the Add button and choose Task Scheduler from the list of available Triggers.
How to configure Task Scheduler trigger? Once Task Scheduler configuration is open, we see the default schedule with daily recurrence to begin soon after. Since we need the Task to run not once per day, but once per 90 minutes, change schedule type from daily to minutes. Set appropriate Start date and configure Task Scheduler to Recur every 90 minutes. Click OK to return to Task Wizard, and click Next to proceed to adding Actions.
How to add an Action? To add an Action, click Add button in Actions tab of Task Wizard and select the necessary Action from the Add Action window list. Upon choosing the Action, its configuration is opened. When finished configuring the Action, it is added to the list of Task's Actions. The order of Actions in the list also means their execution order.
How to configure Move File Action to move files automatically? The first Action according to our scenario is Move File Action that will move all
.jpg images from
C:\Outbox\ folder. Add Move File Action to the Task. Now we need to specify which files will be moved (source) and to where (destination).
Let us start with the Source input line. First we need to specify the folder from which images will be moved. Put the mouse cursor into Source input line and click on Browse button. Browse to
C:\Share\ and select any
.jpg image file. If no files with
.jpg extension are in the folder, select any other file. If folder is empty, select any other file elsewhere. The only purpose of browsing to
C:\Share\ is to spare typing the folder path into Source input manually. Otherwise just enter
C:\Share\ into Source input. Besides specifying the source folder we also need to indicate which files to take from that folder. To indicate all image files with
.jpg extension use
*.jpg wildcard (where asterisk character
* stands for all names and
.jpg means with extension
C:\Share\*.jpg thus, should be the final parameter in the Source input.
Setting up Destination is a bit easier. We just need to indicate the folder into which to move files specified in the Source input. Put cursor into Destination line, click Browse button and select
C:\Outbox\ folder. (Use Make New Folder button in browse dialog, if non-existent.)
The Move File Action is now set to move files from
C:\Outbox\ folder. Let us click OK and proceed with configuring the next Action.
How to configure Send Email Action to automatically send emails with attachments? Now we should set up Send Email Action which will take all
.jpg images just moved to
C:\Outbox\ folder and send them as email attachments.
Add Send Email Action and fill From, To, Subject and Email text with appropriate email addresses and text. As for attachments, we will need to use path to indicate folder and wildcards for file specification. Enter
C:\Outbox\*.jpg into Attachments field.
C:\Outbox\ indicates the folder from where files will be taken.
*.jpg consists of asterisk symbol
* (all files) and
.jpg (with extension
How to configure Delete File Action to automatically erase files? Add Delete File Action to opens its configuration. We will need to delete all
.jpg images from
C:\Outbox\ folder. In order to specify all
.jpg files we will need to use wildcards once more. Enter
C:\Outbox\*.jpg as File input parameter to specify all files with
.jpg extension located in
Conclusion. Let see the example of how the Task works. Recently, files
report.jpg were copied into the
C:\Share\ folder. Then, file
review.jpg were copied into
After every 90 minutes:
*.jpgto attach to email message all files with
review.jpgas well as recently moved
.jpgimages currently in the folder, namely,
The Task has successfully finished, all involved files are deleted. The same operations will be repeated upon Task next execution in 90 minutes when Task Scheduler will trigger it again.
Alternatively, instead of Delete File Action to delete sent files, we can use Move File Action to move sent images to, say,
C:\Sent Attachments\ folder rather than deleting.
If you have any questions, please do not hesitate to contact our support team.