Unmounting a volume

End user supplied how to documents and discussion.

Unmounting a volume

Postby Scott_R » Sat May 31, 2008 10:50 pm

I set up a shortcut to launch an application after a particular network volume is mounted.

However, I'd like to unmount that volume when I quit the application; I don't seem to see a way to do so. Is it possible?
Scott_R
 
Posts: 27
Joined: Thu Feb 16, 2006 7:46 pm

Postby gb2 » Sun Jun 01, 2008 9:50 am

use the "app event" trigger setup with your application in the "Application" pop-up and the "Event" pop-up set to "Quits". Then use the AppleScript below in a AppleScript step. Inside the quotes substituting your hard drive name.

Code: Select all
tell application "Finder"
try
eject "hard drive name"
end try
end tell
User avatar
gb2
Site Admin
 
Posts: 2878
Joined: Mon Feb 06, 2006 6:22 pm

Postby Scott_R » Sun Jun 01, 2008 11:45 am

Thanks, that did the trick.
Scott_R
 
Posts: 27
Joined: Thu Feb 16, 2006 7:46 pm

Re: Unmounting a volume

Postby Felix » Mon Apr 05, 2010 5:57 am

I'm trying to un-mount a local HD volume with this script, but it doesn't work.
Any help?
Felix
 
Posts: 7
Joined: Sat Apr 03, 2010 3:39 pm

Re: Unmounting a volume

Postby gb2 » Mon Apr 05, 2010 12:24 pm

looks like the Finder doesn't think that local drives are ejectable. I was able to get this to work.

Code: Select all
tell application "Finder"
try
do shell script "diskutil unmount \"hard drive name\""
end try
end tell
User avatar
gb2
Site Admin
 
Posts: 2878
Joined: Mon Feb 06, 2006 6:22 pm

Re: Unmounting a volume

Postby ricric » Thu Jan 23, 2014 2:40 am

Wow, now several years and OS versions later I found this a great help. Many thanks, Richard
ricric
 
Posts: 18
Joined: Wed Jan 03, 2007 4:58 am


Return to QKM How Tos

Who is online

Users browsing this forum: No registered users and 4 guests

cron