In my first Automator tutorial I showed how to build and run a simple Automator workflow.
In this tutorial you learn how to create a scheduled Automator workflow that automatically sends birthday greetings to people in your Address Book. Along the way, you’ll learn:
- How to use Automator to find contacts from your Address Book
- A really easy way to send birthday greetings with Automator, and
- How to schedule Automator workflows in iCal, so that they run automatically on a regular basis.
Ready to automate? Let’s get started!
Tip: You can click any of the screenshots below to enlarge them.
1. Create the workflow
I showed the basics of starting Automator and creating a workflow in my last tutorial. As before, start Automator then click the Custom icon to create a custom workflow, then click Choose:
2. Add an action to find people whose birthday is today
Automator provides many actions that can work with contacts in your Address Book. To view them all, click Contacts in the left hand column of the Actions/Variables pane.
The action that we’re interested in here is Find People with Birthdays, so drag that action into the right-hand Workflow pane. The default setting finds contacts whose birthday is today, which is exactly what we want:
3. Add an action to compose a birthday greeting email
Now that you have a list of the people whose birthday is today, you can send each of them an email message. Apple provides many actions for automatically composing and sending emails, giving you a lot of flexibility. Handily, one of these actions is Send Birthday Greetings, which not only sends a “Happy Birthday” email, but even lets you attach a birthday card image to the message.
To add this action, click the Mail item in the left hand Actions/Variables column, then drag the Send Birthday Greetings action to the bottom of your workflow. This will send a greeting email to all of the contacts that were found by the Find People with Birthdays action:
Once you’ve done that, you can customize the action if you like. For example, you can add your own greeting, choose a card image to send, or opt to send a random card to each recipient. (Unfortunately you’re stuck with the 6 cards that Apple gives you – if you want to attach your own image then you can use the Add Attachments to Front Message action.)
4. Add an action to send the email(s)
The previous action merely composes the email messages in Mail, ready to send. To actually send the messages, you need to use the Send Outgoing Messages action. Drag this action below the Send Birthday Greetings action in the workflow:
5. Save your workflow as an iCal Alarm plugin
You’ve finished creating your workflow to send birthday emails, so now it’s time to save it. You’ll save it as an iCal Alarm plugin, which means that you can use iCal to schedule the workflow to run each day.
Choose File ⇨ Save As Plug-in. In the sheet that appears, choose iCal Alarm for the Plug-in for setting, and name the workflow Send Today’s Birthday Greetings, then click Save:
Tip: Automator saves iCal plugins as applications in the ~/Library/Workflows/Applications/iCal folder.
6. Schedule the workflow
Once you click Save, iCal pops open and automatically creates an event for your workflow. Click the Edit button to schedule the event. You can then set it to run every day at midnight, for example:
Tip: Automator creates an “Automator” calendar and puts scheduled workflows in it. You can then avoid clutter in iCal by deselecting the “Automator” calendar to hide all the workflow events.
That’s it! Every day at midnight – assuming your Mac is awake then – iCal runs your scheduled workflow and sends a birthday greeting email to anyone in your contacts who has a birthday that day. Simple!
I hope you enjoyed this introduction to scheduling Automator workflows with iCal. As you can see, the combination of Automator and iCal’s flexible event handling makes it really easy to create automated daily tasks.