10.4: An AppleScript to automate Address Book backups

Dec 01, '05 06:13:00AM

Contributed by: kainewynd2

Tiger only hintI was browsing through old hints and the forums the other day and I came across this hint about Address Book and iCal data loss during a sync on 10.4. As usual, the first thing in my mind was, how do you automate backups then? While searching for an answer, I came across this forum post on applescript.net. I took some of the code there and made this AppleScript to perform an automated backup via ApplesSript UI scripting. I found that using the iCal AppleScript appointment reminder is a nice way for those of us who don't like using cron to schedule backups and such.

There are some Apple failsafes built into the code to make sure that UI scripting is enabled. Also, I did make the "move" section hard coded to the ~/Documents/ABBackup/ folder, so make sure that is created prior to running the script. I know that this works on Tiger, but because of the UI scripting, I am not sure if it will work on previous system builds.

NOTE: You do have to have the "Enable access for assistive devices" box checked in the Universal Access preference pane, so that the UI scripting code works.

[robg adds: I tested this, and it works as described (I didn't schedule it via iCal; just ran the script in ScriptEditor). If someone tests this on 10.3, please let me know if it works and I'll take off the 10.4 tag...]

Comments (9)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20051122133402732