Automate Academy Triggers
Automate Desktop

File Trigger

Chapter 3 | Automate Triggers

Learn how to use the file trigger to start an Automate task. The file trigger starts an Automate task when a file is added, removed, renamed, or modified within a file system or folder. Pat Cameron, Director of Automation, gives you a guided tutorial on how to use the file trigger in Automate. In this video you’ll learn how to:

  • Choose the folder and subfolders to monitor
  • View options at the file or folder level
  • Create and use variables
  • Run the trigger
  • Make sure your file trigger is working

Watch this chapter now to learn more about the file trigger.



[Pat Cameron:] Let's take a look at how we can use file change or file add to trigger an Automate task.

I've got a task here and I'm going to add that trigger by using the edit trigger and as you can see, we've got lots of different triggers that we can use. Today, we are going to be looking at a file system trigger. So if I edit the one I've got, we are going to monitor this [00:00:30] file trigger's folder so we need to tell Automate what folder do I want to monitor the subfolders as well and we are going to wait for that file to be accessible so it's not locked.

As you can see here, you've got different options that you can use at the file or the folder level.  You can also monitor for the number of files or the number of folders and then file size or folder size. So either of those can be a trigger.

I'm just going to monitor for invoices so any file that starts with inv [00:01:00] is going to cause this trigger to trigger. I don't need any special user and I want to have this trigger enabled. We'll take a quick look at the task that I've got set up here. So what I'm going to do is, I'm going to monitor for that file and then I'm going to take it and put a date stamp on it so I've got a variable created for the date and move it to an archive folder. [00:01:30] So I've got a variable for the location for my archive folder that I'll be using and then I'm also going to create a variable for just the file name. I'll show you how to use that.

When you use a trigger to cause an Automate task to run, Automate automatically creates some variables that you can use in the task. I've got a file name trigger and if you go to the expression builder and open up objects and then triggers, you can see here the list of the different [00:02:00] triggers that you can use. And if we take a look at the file system, these variables are available for you to use in your Automate tasks. So my source file is the file name and I'm going to parse that file name out because I want to move it and just pull out the file name. Other options I could use here if the file is older or newer than a certain time, but I am just going to use the trigger name. And then in my move option, [00:02:30] here's my source file, again that trigger and now I've got a variable for my destination, the file name, and then I am adding today's date to that file.

So let's run this and you can see what it does. So in order to run it and do some testing, I've got to trigger the trigger. What I am going to do is I am going to copy and paste a file into that monitor directory. If I just paste my invoice in there, you can see immediately, [00:03:00] my task starts running and when it finishes it, it moved from my original destination to the archive destination.

Let me show you how those variables work. So if we go back to the task, I've got a couple of displayed messages here that I am just going to display the value of those variables as this task runs. I like to do this during testing to make sure that I am getting the result [00:03:30] that I expect when I set up a variable or a data set, et cetera. So I will trigger this again by pasting that file back in that monitored folder. And now I will get a couple of pop-up messages as this task executes. The first one is the value of the AM trigger and as you can see it's an Automate samples file trigger. My invoice one PDF file. And then the other one, here's my archive directory and then just the [00:04:00] file name, invoice one. So I have combined those for my destination.


Ready for the next chapter?

Chapter 4: Email Trigger