-- iCal "Sync before run" Wrapper -- Copyleft (c) Alexandre Gauthier -- www.underwares.org -- www.raptorized.com -- First, we try to run our automagical sync script. try do shell script "bash /Users/supernaut/bin/ical_sync.sh" tell application "iCal" activate end tell on error errorMessage number exitcode -- here, I simply ask if we should run iCal even if sync failed. -- There are times where, you know, you want to use iCal anyways, -- even when the network is down. This allows investigation upon -- borkage to take place without overwriting junk on the WebDAV -- server without your knowledge. display dialog "This crapped out: -" & errorMessage & "(" & exitcode & ")" set q to display dialog "Launch iCal anyways?" buttons {"Yeah", "Nope"} default button 2 set a to button returned of q if a is equal to "Yeah" then tell application "iCal" activate end tell end if end try