Bento Syncing with Applescript



As I continue my attempts to synchronize using two Macs I have run into a wrinkle. My database application, Bento, does not sync. Since I'm only using one machine at a time, and the address and iCal data is already synced, it works fine if I just copy the database file between computers when switching. The trouble is that Bento insists the database be located in my Application Preferences/Bento folder so it is a pain to drill to it and copy it over to my iDisk. This seemed the perfect excuse to try my Applescript chops. So here is the script:

set SendOrReceive to button returned of (display dialog "Hey Sparky, Sending or Receiving?" buttons {"Sending", "Recieving"} default button 2 with icon caution)

set LocalBentoFile to POSIX file "Users/david/Library/Application Support/Bento/bento.bentodb"

set iDiskBentoFile to POSIX file "/Volumes/iDisk/Documents/Bento Data/bento.bentodb"

set LocalBentoFolder to POSIX file "Users/david/Library/Application Support/Bento/"

set iDiskBentoFolder to POSIX file "/Volumes/iDisk/Documents/Bento Data/"

tell application "Finder"
if SendOrReceive = "Sending" then
duplicate LocalBentoFile to the folder iDiskBentoFolder with replacing
duplicate iDiskBentoFile to the folder LocalBentoFolder with replacing
end if
end tell

This script asks if I'm sending (to iDisk) or receiving (from iDisk) and then copies the file in the right direction. I thought about making it more automatic by comparing dates and duplicating the newest version in both places, but decided I want to have control over what direction the sync is going.

If anyone out there has any ideas for improving it, let me know or leave a comment.