Apple Mac OS X tips and tweaks
Announce Address Book contact birthdays using Automator
A recent article showed how to use Automator in OS X on the Apple Mac to announce any birthdays occuring today so you don't forget to send the person your best wishes.
It examined your iCal calendar and looked for events with the word 'birthday' on today's date. This article shows a variation of this theme and this Automator workflow goes through your contacts in Address book and checks the birthday field (if you have added it), and if there are any contacts with birthdays this week, it announces their name.
You can set it to automatically run every time you start your Mac or log in. This obviously isn't going to change the world, but if you want to know how to use Automator, you'll learn a few useful tips by looking at this workflow.
Part 1: Find people with birthdays
Start Automator in the Applications folder and when you are prompted to select a template, choose Application. Make sure that Actions is selected in the top left corner. Select Utilities under Library and the second list displays all the actions in this category. Double click Set Computer Volume to add it to the workflow on the right and expand it if necessary by clicking the little triangle on the left of the title bar so you can see the contents. You can now set the volume you want for the birthday announcements. This action isn't essential and if you don't add it then the current volume setting is used. You may prefer this so feel free to leave out Set Computer Volume if you want.
Select the Contacts category in the library and double click Find People with Birthdays to add it to the workflow. Expand it if necessary and choose This week in the pop-up menu. Of course, you could choose any of the other options, such as Today, Tomorrow and so on. They'll all work just as well. Double click Get Contact Information in the library to add it to the workflow and expand it to see the options. Select the fields you want to speak, such as the first and last names (tick the Combine Names option at the bottom), and birthday. Clear the Add Labels tick box at the bottom.
OK, we've found contacts with birthdays this week and have extracted their names and birth dates. Find Copy to Clipboard in the library and add it to the workflow. We're temporarily going to store the information on the clipboard.
Part 2: Announce the birthdays
What we want to do is to speak the birthdays out loud using the Speak Text action. The problem is that if there aren't any birthdays this week then there is no text to speak and Speak Text stops with an error message.
One way around the Speak Text problem is to ensure that there is always some text to speak, even if there are no birthdays. Drag the Get Specified Text action from the Text category and drop it at the end the workflow. You'll see a box where you can enter some text. Enter "Birthdays this week" into the box. Then drag Get Contents of Clipboard and insert it after it. Remember that we placed the birthday people on the clipboard? Get Contents of Clipboard is added to the text in Get Specified Text so it says something like "Birthdays this week, Bob Smith 10/05/1982." Unfortunately, it will still say "Birthdays this week" even if there are no birthdays, but at least there's no error and Speak Text has something to say.
Create the app
Go to Automator's File menu and select Save. It is saved as an application - an executable program. It can be run like any other app by double clicking it.
Now here's the useful bit. Go to the Apple menu then System Preferences. Click Accounts and then the Login Items tab. Drag the app you just created from the desktop or Finder window wherever you saved it and drop it on the Login Items list. This means that it will be run every time you log in or start the Mac. Log in and any birthdays occuring this week will be spoken out loud!
Go to Apple Mac and OS X tips and tweaks index...