Back up your contacts
The first task we want to tackle is creating an archive of all the contacts in Address Book. Now that we have iCloud, it’s possible to scatter these contacts across devices and the Web. In the process, contacts can become corrupt or spawn duplicates. For this reason, it’s a good idea to archive them every so often. You can do this manually by launching Address Book and choosing File -> Export -> Address Book Archive. Of course, you have to remember to do that. With Automator, no memory is required.
Launch Automator (in /Applications) and from the workflow template that appears, select iCal Alarm and click Choose. Select the Contacts entry in the Library pane and, from the Actions pane, drag Find Address Book Items to the workflow area. From the Find pop-up menu choose groups and in the area below configure the condition to read Name is Not 1111111. (Assuming you don’t have a contact with this name, we enter this nonsense string so that the action will find all of your contacts.) The action’s name will change to Find Address Book Groups.
Next, drag Export vCards into the workflow area and configure it to read Export One vCard to Documents. As the condition suggests, this will create a single vCard document that contains all your contacts and place it in the Documents folder within your user folder.
This will be a repeating event that we’ll configure to occur once a month. With that in mind we’ll need to rename these archives each time they’re saved so that they don’t appear as duplicates from the previous month (thus risking overwriting our older archives). To do that select Files & Folders in the Library pane and from the Actions pane drag Rename Finder Items to the workflow area. You’ll be prompted to add a Copy File action. Click Don’t Add—you don’t need it.
The only things you need to do in this action is ensure that Month Day Year is chosen in the Format pop-up menu and that the Use Leading Zeros option is enabled. This will append the date to the file (for example, the file name might look like Filename 02/05/2012.vcf), making it easy to identify when the archive was created. This will be a big help if you need to traipse back through contact archives to find the one that best works for you. We’ll now add a couple of more actions to this workflow to take care of calendar events.
Create an iCal events archive
Specifically, we’ll create a text document that provides a summary of all the events on our calendar from the past month. This is handy if you inadvertently delete past calendar events and later realize that you need a record of your whereabouts—for a tax audit or SEC investigation, for example. We’ll add these actions onto the same workflow we’ve been working on.
Select Calendar in the Library pane, choose Find iCal Items, and drag it to the workflow pane. Make sure that the first condition reads Find Events Where. Below it should be configured to read Date Starting is in the Last 30 Days. This tells Automator to locate any events that have occurred in the last month.
We’ll now ask Automator to make a list of these events by choosing Event Summary from the Actions pane and dropping it below the Find iCal Events action. To create a text file that contains that summary, click the Text entry in the Library pane and drag the New Text File action to the bottom of the workflow. In the Save As field enter Monthly Events and, with the Where pop-up menu, choose to save it in the Documents folder.
This is another file we’ll want to be renamed each time a new version is created. So, move back to Files & Folders in the Library pane and drag the Rename Finder Items action to the bottom of the workflow. Configure it as you did before, with leading zeros and a Month/Day/Year format.
Save the workflow and you’ll be prompted to name it. Do so and click Save. iCal will open and create a new event in the Automator calendar. (It will create the Automator calendar if one doesn’t exist.) Within that calendar event click on Repeat and choose Every Month. Click Done and then move the event to the 28th day of the month. (There’s a reason I chose the 28th. If you set a Monthly repeat and place it on the 31st, only those months that have 31 days will use the event, it will otherwise not happen until the next month that contains 31 days.) Alternatively, you can choose Other from the Repeat pop-up menu and configure it so that it triggers on something like the last Friday of every month.
Note that a bug remains in Automator that can cause iCal workflows to suddenly change to standard workflows. If this happens while you’re constructing this workflow, try building it again as an iCal Alarm workflow.
With this workflow in place, each month you’ll have a backed up archive of your contacts, which you can later import into Address Book should something bad happen to your existing contacts. You’ll additionally have a text file of all your calendar events from the month you’ve just lived through. Here’s to creating a little more order in your life.