Seemless Bluetooth iSync

In my last post, I wrote about how I got HomeZone to detect my bluetooth phone, and automatically start iSync. While I was playing with it, I noticed how HomeZone opens the Address book application and iSync, and doesn't close them. To make it more seemless, I used a script I found at The Technocrat to start and stop iSync without interfering with your work. Here's how I did that.

First, I opened the script editor and typed the following script into it (slightly modified from the one at Technocrat):
tell application "Finder"
    set iSyncRunning to (number of items in
         (processes whose name is "iSync") is greater than 0)
    tell application "iSync"
        if last sync is less than ((current date) - 120) then
            synchronize
        end if
    end tell
    tell application "iSync"
        repeat while (syncing is true)
            delay 1
        end repeat
        if iSyncRunning is not true then
            quit
        end if
    end tell
end tell

Then, I saved this script as an application called "iSyncNow.app" . On the save dialog, make sure that "keep running" and "show on screen" are NOT thicked, like so:

Then, open the HomeZone preferences and configure HomeZone to run this application when your phone is in range. My configuration looks as follows:

With this simple little trick, my Mac Mini has become a lot cooler. When I approach the computer, I see the iSync logo appear in the dock, it bounces a few times, and then it dissapears. My phone is now always synchronized with my iCal, without popups or manual actions.

Please note that the script prevents iSync to synchronize if the last synchronization was less than 2 minutes (120 seconds) ago. You can adjust this by editting the "120" in the applescript to any number of seconds you like.

Have fun! Rolf