An AppleScript to keep your devices in sync

Mar 01, '06 06:22:00AM

Contributed by: ybizeul

One problem with iSync is there is no way to schedule your Bluetooth phone's synchronization. As far as I remember, former versions of iSync did this, but it is no longer possible -- only .Mac synchronization can be scheduled. The only solution I found, since I saw no way to launch a clean background daemon, is to trigger an AppleScript every two hours, for example.

First of all, the AppleScript. I placed it in the Library/Application Support/iSync directory, and named it SyncNow.scpt:

tell application "Finder"
  set iSyncRunning to ¬
   (number of items in (processes whose name is "iSync") 
   is greater than 0)
  tell application "iSync" to synchronize
  tell application "iSync"
    repeat while (syncing is true)
    end repeat
    if iSyncRunning is not true then
      quit
    end if
  end tell
end tell
Then add this entry to your crontab (edit in Terminal with crontab -e):
0 */2 * * * osascript Library/Application\ Support/iSync/SyncNow.scpt
This will sync every two hours; type :x to quit the text editor, and you are done.

Comments (10)


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