iCal: Backup

(thx: Kim Hunter.) Backs up iCal to Desktop. (Requires UI scripting enabled.)

--Backup iCal
tell app "iCal" to activate
delay 2¨tell app "System Events"¨tell menu item "Back up Database." of menu "File" of menu bar 1 of application process "iCal" to click¨delay 3¨keystroke "iCal"¨keystroke "d" using command down¨delay 2¨keystroke return
end tell

Hello,

I’m running Tiger 10.4.4, and I’ve just tried this script, which unfortunately doesn’t work for me, I get some errors. So I had to modify it as shown below in order to run.

try
tell application “iCal”
activate
delay 2
tell application “System Events”
tell menu item “Back up Database…” of menu “File” of menu bar 1 of application process “iCal”
click
delay 3
keystroke return
end tell
end tell
end tell
end try

Somehow nothing happens except iCal getting to the foreground.

Model: PPC Dual G4/2GHz
AppleScript: 1.10.3
Browser: Safari 417.8
Operating System: Mac OS X (10.4)

hate to bump a really old thread, but i used to use this option to back up my ical and it worked fine for the longest time, but i think it was after an update that it stopped working. nothing changed as far as the menu or anything…it just didn’t work anymore. so i finally just went the easy route and thought i would share it in case anyone else was having the same problem.

step one:
make sure you have the developer tools installed from the osx disk.

step two:
show contents of ical and go to Contents > Resources > English.lproj (or whichever language you are using) > MainMenu.nib. open this file and it should open up interface builder. click on the ‘backup ical’ menu option in there and then in the menu item attributes window, you can set the keystroke equivelant. i just used command+option+b. save and quit.

step three:


tell application "iCal"
	activate
	tell application "System Events"
		keystroke "b" using {command down, option down}
		delay 1
		keystroke "d" using command down
		delay 1
		keystroke "iCal"
		delay 1
		keystroke return
	end tell
end tell
delay 1
tell application "iCal" to quit

i use this same method for backing up my address book, my safari bookmarks, my ical, and 1pass all at the same time. i just have it on a daily backup rotation to my thumb drive.

hope that helps someone. :wink:

Model: iMac 20"
Browser: Safari 530.19
Operating System: Mac OS X (10.5)