PDA

View Full Version : applescript not working any more after upgrade


snoopy1967
05-08-2007, 07:22 AM
I've been using the following applescript, in order to do an automated backup whenever i plug in my external firewire disk.
[For the curious: the script gets run by 'peripheral vision".]

The problem now is that the script produces an error in SD (something about the event ..)

Can anyone tell me how to modify the script to make it run again?


Thanks a lot in advance.

Best regards,
Gabriel.



Here is the applescript:


-- allBackupSettings should contain the names of all saved SuperDuper! backup settings to cycle through
-- any external volumes referenced in the saved backup settings used should be mounted before running this script
property allBackupSettings : {"incr1", "incr2"}

-- backupSettings will retain the name of the backup settings used for the last successfully completed backup
property backupSettings : ""

-- set new backup settings to use, cycling through the list of saved settings
set previousBackupSettings to backupSettings
if backupSettings is "" or backupSettings is last item of allBackupSettings then
set backupSettings to first item of allBackupSettings
else
repeat with i from 1 to (count allBackupSettings)
if backupSettings is item i of allBackupSettings then
set backupSettings to item (i + 1) of allBackupSettings
exit repeat
end if
end repeat
end if

-- sleep a few seconds to allow OS to properly mount the external volume
-- (reason: i set up Peripheral Vision to automatically start this script
-- as soon as it has detected that the external HD was connected)
tell application "System Events" to do shell script "sleep 3"

tell application "SuperDuper!"
try
--Wait until SuperDuper! is idle before loading and running the desired session
repeat while status is not idle
--Sleep # seconds is the best way to "wait" without using the CPU
tell application "System Events" to do shell script "sleep 5"
end repeat
if status is idle then
--Specify the saved settings as either an absolute path or just the name
«event SDprRunn» without «class noUI» given «class fIlE»:backupSettings
end if
--Wait until the session is done
repeat while status is running
tell application "System Events" to do shell script "sleep 3"
end repeat
on error errMsg
-- backup failed, so restore saved backup settings last used
-- N.B. backup stopped by user is considered successful by SuperDuper in this context
set backupSettings to previousBackupSettings
display dialog errMsg & " See section 12 of the User's Guide for help with this script."
end try
--Once done, tell SuperDuper to quit
quit
end tell

dnanian
05-08-2007, 08:16 AM
Looks like it was created with v1.x of SD. Try recreating the run part, which looks wrong now...