Automator: Scheduling Workflows to Run Automatically

In yesterday's Automator blog post (Automator: Understanding the UI and Creating Your First Workflow), I walked you through how to create your very first workflow using Automator. It was a simple workflow, but hopefully it gave you a good idea of how to begin using Automator to automate your very own workflows.

In this post, I will take things a little deeper and walk you through creating your first multi-action workflow, explaining how each action feeds into the next. I will also show you how to convert that workflow to a calendar item, which will allow us to schedule it to run automatically.

Let's get started!

In this example, we're going to create a workflow that sends an email to anyone in our Address Book who has a birthday today. To do this, we need to create a new "Workflow" document.

With our blank canvas open, we'll need to drag various actions onto the canvas to build our workflow. In this example, there will be three actions:

  1. Gather a list of people (using Address Book) who will be celebrating a birthday today
  2. Generate a "Happy Birthday" email
  3. Send those emails

Before we continue, let me interject a concept here that you will need to understand when using Automator (it may seem obvious to some, but maybe not all). When you run your workflow, it will always begin with action #1. When it's done processing action #1, it will move on to action #2. When it's done processing action #2, it will move on to action #3, and so on. This is important to keep in mind as you build your workflows because if you have actions in the wrong order, you may get some pretty funky results. For example, if we tried to send our emails before they were created, the workflow wouldn't make sense, and we would get errors.

In some cases, one action will gather data to be used for future actions. In this example, action #1 will actually gather a list of contacts who have a birthday today, then will pass that information along to action #2 to perform its task of generating a new email.

At this point (after reviewing yesterday's intro to Automator's UI post), you should be able to navigate around enough to search for and use the actions we need for this workflow. If you're a little stuck, I will give you some hints. These are the three actions we need (in this order):

  1. Address Book: Find People with Birthdays
  2. Mail: Send Birthday Greetings
  3. Mail: Send Outgoing Messages

Once you have built your workflow, it should look like this:

If yours looks different to mine, be sure to adjust yours so that it looks the same. At this point, you can play with the settings as well as create your own custom birthday greeting (action #2). When you're ready to test your workflow, press the "Run" button (note: if you want to test the workflow withOUT actually sending the emails, you want to remove the 3rd action from the workflow, then re-add it when you're ready to go live).

Now that we have determined that your new workflow actually works the way it's designed, it's time to schedule it (after all, the idea is to save you time, not create more work for yourself!). Doing this is simple.

First, we need to change the document type from "Workflow" to "Calendar Alarm". To do this, we will go to File | Convert To... This will create a duplicate document. Be sure to select the type "Calendar Alarm", then save the new file using a meaningful name (i.e.: "Birthday Greeting (Scheduled)").

At this point, Automator will automatically create a new calendar in the Calendar app called "Automator", and schedule your workflow to run. You will also receive the following prompt:

Because our workflow needs to access your Address Book to gather birthday data, we will want to choose "OK".

If you look at your calendar now, you will see a new event with the same name as the saved workflow document we just saved. There are two changes we will probably want to make to complete this process:

  • Change the scheduled run time (the default time will be the time that you originally created the event)
  • Set a recurring schedule (for most, you will want this workflow to run daily)

Both of these changes can be made within the details of the scheduled event by double-clicking on the event. Once you've made the changes, it should look something like this:

If yours doesn't look like mine, make the necessary changes so that it matches. At this point, you may also want to hide your new Automator calendar. This just hides the calendar from your view (reducing clutter). Your scheduled Automator actions will still run as expected.

That's it! We just created our fist multi-action workflow AND scheduled it to run automatically every day. Congratulations!

Posted on January 22, 2014 and filed under Design, How To, Mac.