Scheduling iSync

One of the problems I’ve discovered with using iSync is that there doesn’t seem to be a way to schedule it. A few people have solutions but all of them open the full iSync application; I prefer using the menubar icon which opens iSync but doesn’t pop up any extra windows on top of what I’m doing.

I started with a basic sync script, then followed one of the comments to an advanced script that toggles the bluetooth state via the menu bar before syncing. I don’t need to turn off BT, but the script gave me a good starting point for what I wanted to do. After some quick debugging to find the iSync menu name, I now have my script – it still has to switch the focus to the menu bar for a second but it happens so fast that I doubt I’ll notice.

Here’s the script for anyone who is interested – although it has only been tested on 10.5. It looks horrible in the width-restricted blog theme but it will copy/paste correctly (or just load it via the RSS feed):

tell application “System Events” to tell the front menu bar of process “SystemUIServer”
    set menu_extras to value of attribute “AXDescription” of menu bar items
    repeat with x from 1 to the length of menu_extras
        if item x of menu_extras is “Sync” then exit repeat
    end repeat
    tell menu bar item x
        click
        tell 3rd menu item of front menu
            click
        end tell
    end tell
end tell

For those of you who are scared of shell scripting there’s even CronniX to help you schedule it (hat tip to the original article for that link). It’s still a confusing process if you’re not familiar with crontab but it’s easier than learning the file format.

Just don’t forget that you have to use the osascript command to run applescript files, and you have to manually enable GUI scripting via the AppleScript application before this script will work.

6 thoughts on “Scheduling iSync

  1. iTunes is easy – just start listening to podcasts. Once I started requiring a daily sync to get my updates, it didn’t take long to build up a habit of plugging my iPod in every night.

  2. for newbies like me –

    1. after cut/pasting the script into Script Editor, change the quotation marks to straight quotes “”. Save as script.

    2. go to Applescript Utility and check “enable GUI scripting”

    3. go to iSync > Preferences and check “show menu bar status”

    easy way to set this up daily: create a daily iCal event. Instead of an alarm, use the drop-down and select “script” instead

  3. Thanks for the GUI based tip, I forgot to mention the show menu bar option 🙂

    The quotation marks are straight quotes in the post I wrote, but WordPress seems to have translated them 😦

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.