Here's how I got it to work. The idle handler in the AppleScript checks whether SuperDuper is running; if so, it comes back after 2 secs to check again. When SD is gone, that must mean the share isn't being used any more. So then it ejects, then quits itself. (Replace "YourShare" with the name of your share.)
The Applescript needs to be saved as App, with "stay open" option active.
Code:
global BackupInProgress, BackupPartPresent
on goodbye()
quit
end goodbye
on idle
if BackupInProgress is false then
tell application "Finder"
if (exists the disk "YourShare") then
eject "YourShare"
set BackupPartPresent to false
end if
if (exists the disk "YourShare") then
end if
end tell
goodbye()
else
tell application "System Events" to (creator type of processes) contains "SdPr"
set BackupInProgress to the result
-- beep 1
--return 2
end if
return 2
end idle
on run
set BackupPartPresent to true
tell application "System Events" to (creator type of processes) contains "SdPr"
set BackupInProgress to the result
idle
end run
Since SD can't seem to call scripts that stay open, I have this snippet called from SD (replace "/path/to/TheAppleScript.app" with path to where your Applescript resides)
Code:
open ~/path/to/TheAppleScript.app
exit
For some reason, I couldn't get it to work with the "osascript" command.
Actually this feature should really be built in!