Maestro Monday: Backup OS X Contacts

This weeks Keyboard Maestro macro is one that backups up my OS X Contacts.

This week’s Maestro macro is entirely self-contained, no Apple Script or external utilities needed. The macro exports the OS X Contact list (aka Address Book) to a file that can be imported later if it’s needed. The two restrictions are that the screen cannot be locked when the script runs and it can only be run once per day. The macro runs on Mavericks, it may need to be changed for earlier versions (for example, when “Contacts” was called “Address Book”).

I set this macro to be triggered only from the status menu. I have a regular weekly backup routine and run it at that time. While I prefer automated backup solutions, having to be at the computer to trigger isn’t a problem in this case. My weekly routing includes making sure the backups ran OK and this one runs so quickly it adds almost no time to how long it would take to verify the backup. Plus if I make a lot of changes I can easily do an immediate backup.

This script is one of the longer ones when measured by screen real estate. The process is straight-forward: Start contacts if needed, export the contacts using the export menu, change the location to where I want it and save the file, then quit contacts. There are some pauses in there to give the app time to respond.

The export command automatically includes the date in the file name so the file will have a unique name every day. If the macro is run twice in one day it will break. It will prompt to replace the file and the remaining shutdown command will be lost. This hasn’t been a problem for me so I haven’t taken the time to create a workaround.

Screen capture of macro to backup OS X contacts