Nov 19, '03 10:14:00AM • Contributed by: Christian Leue
try
-- pick up current "my card"
tell application "Address Book" to set CurrentMyCard to my card
-- invoke a sync
tell application "iSync" to synchronize
-- wait for sync to finish
repeat
tell application "iSync"
if (syncing is false) then
exit repeat
do shell script "sleep 15"
end if
end tell
end repeat
-- tell 'em who's the boss if iSync changed it
tell application "Address Book"
set NewCurrentMyCard to my card
if NewCurrentMyCard is not CurrentMyCard then
set my card to CurrentMyCard
save addressbook
end if
end tell
end try
PS: I seem to recall that it used to be difficult to run AppleScripts from the crontab. I don't know if it is new in Panther, but I used the "save as a program" option in Script Editor 2.0, and placed a reference to it directly in my crontab for execution at 10 minutes to the hour:
50 * * * * /Users/myaccount/Scripts/sync_restore_my_card.appAnd it worked as expected...
