AppleScript: automatic iSync
Apple November 9th, 2006Let’s start a new section of my website! In those days I’m looking at the AppleScript and I found that it’s really powerful and integrated in OSX!!
This script I made is for automatically open iSync, syncronize all the devices and close it, notifying the result in a Growl box!
I’m using it with cron twice a day, so I don’t have to remind to sync…
Enjoy it!
tell application “iSync”
synchronize
repeat
delay 5
if syncing is true then exit repeat
end repeat
repeat
delay 5
if sync status = 2 then exit repeat
end repeat
delay 1
set lastdate to last sync
quit
end tell
tell application “GrowlHelperApp”
– Make a list of all the notification types
– that this script will ever send:
set the allNotificationsList to ¬
{“Finito”}
– Make a list of the notifications
– that will be enabled by default.
– Those not enabled by default can be enabled later
– in the ‘Applications’ tab of the growl prefpane.
set the enabledNotificationsList to ¬
{“Finito”}
– Register our script with growl.
– You can optionally (as here) set a default icon
– for this script’s notifications.
register as application ¬
“MySyncNow” all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application “Script Editor”
– Send a Notification…
notify with name ¬
“Finish” title ¬
“Sync N80 Ended” sticky yes description ¬
“Sync ended @ ” & lastdate application name “MySyncNow”
end tell

