Hi all,
Relatively simply little AppleScript here for backing up AddressBook. Only sometimes does the the backup dialog accept the "return" press as an actual return. The keystroke fileName works great, but then the background of the text becomes highlighted. So it seems like it's sometimes taking it as a literal ENTER character instead of the implicit "Save" click.
-- Bring iCal to the front
tell application "Address Book" to activate
delay 5
-- Click the "Backup" menu item
tell application "System Events"
tell menu item "Back up Address Book…" of menu "File" of menu bar 1 of application process "Address Book" to click
delay 3
-- Enter the filename into the field
keystroke fileName
delay 1
-- Press ENTER to perform the backup
keystroke return
delay 5
end tell
Two ways to solve this:
(1) Figure out why this enter press isn't working OR
(2) Have the AppleScript click the Save button. I'd prefer this approach but cannot for the life of me figure out how it's done.
Any help is much, much appreciated. Thanks in advance =)
Rob