Automator workflow of the month: Filter Address Book contacts
By Christopher Breen, Macworld
There are times when you need to grab a related group of contacts and then do something with that group—create a quick mailing list or cobble together vCards for exporting those contacts to mobile devices or applications. There’s no need to do a task like this by hand when you’ve got OS X’s Automator utility (in /Applications/Utilities).
Start the process by launching Automator and, from the template sheet that appears, select Application. We’ll first construct an application that lets you create a mailing list. To do that, add these actions: Find Address Book Items (found under the Contacts heading), Get Contact Information (also under Contacts) and New TextEdit Document (in the Text group).
Click the Options button in the Find Address Book Items action (which now reads Find Address Book People) and enable the Show This Action When the Workflow Runs option. In the Get Contact Information action check any items that you want to appear in your mailing list (and uncheck those items you don’t want to appear). If you don’t want the list to contain labels such as Work Address and Mobile Phone, uncheck the Add Labels option.
Save the workflow and click the Run button in the workflow window’s top-right corner. A Find Address Book People window will appear from which you can configure the search options. For example, I might configure it to read Find People Where Email Contains Macworld.com. This will locate any contacts who have a Macworld.com address. Or you could enter Zip Code Begins With 94107 to find contacts within certain sectors of San Francisco. Regardless of the criteria you create, click Continue and the workflow will churn through the following two actions and eventually produce a TextEdit document that contains the contacts that match the rules you’ve set.
Prefer vCards to a mailing list? No problem. Delete the Get Contact Information and New TextEdit Document actions and add an Export vCards action as the second step in your workflow. From this action’s Export pop-up menu choose whether you want to export all your contacts in a single vCard or as individual vCards. Which you choose depends on the destination for your exported vCards. Some applications can handle only individual vCards where others welcome multi-contact vCards.