Here's the script:
global bluetoothActive property blueutilPath : "$HOME/bin/blueutil" on adding folder items to this_folder after receiving added_items set podName to "the name of your iPod" if podName is in (added_items as string) then if "on" is in (do shell script blueutilPath & " status") then set bluetoothActive to true else set bluetoothActive to false do shell script blueutilPath & " on" end if try tell application "Finder" if exists POSIX file "/tmp/sync" then set newAddresses to (do shell script "find $HOME'/Library/Application Support/AddressBook/Metadata' -newer /tmp/sync") set newEvent to (do shell script "find $HOME/Library/Calendars -newer /tmp/sync") if "ics" is in newEvent then display dialog "new event " & newEvent giving up after 5 my sync() else if "abcd" is in newAddresses then display dialog "new contact: " & newAddresses giving up after 5 my sync() end if else my sync() end if end tell on error errStr number errorNumber display dialog "find failed " & errStr & errorNumber giving up after 5 my sync() end try if not bluetoothActive then do shell script blueutilPath & " off" end if end if end adding folder items to on sync() tell application "iSync" try synchronize on error display dialog "Sync failed" end try repeat while (syncing) end repeat if (sync status is 2 or 3) then do shell script "touch /tmp/sync" else do shell script "rm /tmp/sync" end if end tell end sync
- If you sync using Bluetooth, you need blueutil. Put it into ~/bin.
- On the fourth line of code, enter the name of the iPod (or the name of whatever you want to trigger a sync when it is added to /Volumes)
- It checks if there are some new or changed events or contacts since last sync (by comparing the timestamps of the iCal and Address Book databases with the time of the last sync). However, this does not work very well, it almost always seems to be new/changed events/contacts, even when I have touched the applications. If someone knows a better way (by asking iCal/Address Book?) to verify this, please comment. It would also be useful if you could limit this check to calenders/contact groups you actually sync.
[crarko adds: I haven't tested this one. The script compiles without error and I've mirrored it here.]

