iSync Reactor

iSync Reactor

This script will launch iSync and ask it to syncronize and terminate.  It will also refresh calendars in iCal.  
Protection is added to prevent frequent syncing and leave iCal/iSync running if they were already running

Author: Phill Sparks <>
License: Creative Commons Attribution-ShareAlike 2.0 UK: England & Wales
License URL:

property sync_frequency : 900 -- seconds

-- Find out if iCal and iSync are already running
tell application "System Events"
    set iCalRunning to (count of (every process whose name is "iCal")) is greater than 0
    set iSyncRunning to (count of (every process whose name is "iSync")) is greater than 0
end tell

-- Syncronize using iSync, at most every 15 minutes
tell application "iSync"
    if last sync is less than ((current date) - sync_frequency) then
        -- Refresh all calendars
        tell application "iCal"
            reload calendars

            if not iCalRunning then quit
        end tell

        -- Do the sync
    end if

    -- If this script started iSync then hide it, wait for it to finish syncing and quit
    if not iSyncRunning then
        tell application "System Events" to set visible of process "iSync" to false

        repeat while (syncing is true)
            -- Wait
        end repeat

    end if
end tell