Shirt Pocket Discussions

Shirt Pocket Discussions (https://www.shirt-pocket.com/forums/index.php)
-   General (https://www.shirt-pocket.com/forums/forumdisplay.php?f=6)
-   -   Unmount share after copy (https://www.shirt-pocket.com/forums/showthread.php?t=1825)

dnanian 12-10-2006 06:23 PM

Teamwork! ;)

eriolarda 12-11-2006 09:08 PM

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!

xtian666 01-02-2007 11:25 AM

Quote:

Originally Posted by dnanian (Post 9780)
I think you'll now be able to do this with a single line, since the mini-script worked, the tricky thing being escaping things properly, and I couldn't figure it out. So put the eject in a little saved script:

Code:

tell application "Finder" to eject "mjg"
save as text or a compiled script, and do:

Code:

#!/bin/sh
nohup /bin/bash -c "sleep 20; osascript path/to/the/script/file" &


The applescript works great, but how do I impliment the shell command into SuperDuper?

dnanian 01-02-2007 11:26 AM

Set it as the "after copy" shell script in the Advanced tab of Options.

xtian666 01-02-2007 11:36 AM

Quote:

Originally Posted by dnanian (Post 10177)
Set it as the "after copy" shell script in the Advanced tab of Options.

Obscenely fast response - you guys rock :-)

But a dense reply... I have the applscript saved and it works fine when I manually launch it. The shell command I assumed would be copied and pasted into the "after copy" section under the Advanced tab. However, this brings up an open dialog box so do I just save the shell command as a text file and then point the "after copy" to that file?

dnanian 01-02-2007 11:39 AM

Yes. You save it as a text file, mark it as executable (chmod +x the-file), and point to that.


All times are GMT -4. The time now is 06:50 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2024, vBulletin Solutions, Inc.