I cannot remember nor find the Applescript syntax for unmounting a volume. Can anyone help?
Thanks.
I cannot remember nor find the Applescript syntax for unmounting a volume. Can anyone help?
Thanks.
the search function is working:
cheers.
I am very new to applescript, however, this works for me.
--> to make the Finder the active process
tell application "Finder"
activate
--> use a try incase the volume is already ejected
try
select window of desktop
eject disk "Your Volume's Name"
end try
end tell
Model: Ibook G4
AppleScript: 2.1.1
Browser: Safari 419.3
Operating System: Mac OS X (10.4)
A little better, perhaps:
tell application "Finder"
repeat until not (exists disk "YourDiskName")
eject disk "YourDiskName"
delay 0.5
end repeat
end tell
Hi Adam,
doesn’t this cause problems, if the eject command is sent over and over again ?
Apparently not, Stefan - this is a snippet from my backup routine which powers up an external drive (with a PowerMate Pro USB-controlled powerbar), waits for it to mount, then runs a script in SuperDuper!. When SuperDuper! quits after the backup, this snippet dismounts the drive and when it’s gone, shuts off the drive. I guess that once the ‘eject’ command is in execution, it ignores any new one.
thanks,
good to know, I use currently the 'do shell script "diskutil unmount ˜ solution
which sometimes doesn’t work properly and returns an error.
This USB controlled powerbar sounds very interesting. I couldn’t find anything about it in the web.
I know PowerMate only as this Griffin multimedia knob. Do you have further informations about the powerbar?
Not cheap, Stefan, but made by Sophisticated Circuits. Comes with the required software (which works). AppleScriptable as well:
-- Turn on work Lamps
tell application "PowerKey Daemon"
try
set level of outlet 3 of unit "PKP" to 100
on error -- fails once in a while, so just do it again, always works second try.
delay 1
set level of outlet 3 of unit "PKP" to 100
end try
end tell
-- OR
set D to do shell script "diskutil list"
if last word of D is "disk1s3" then
do shell script "diskutil mount " & E
else
try
mountExternal()
on error
delay 0.5
mountExternal()
end try
end if
to mountExternal()
tell application "System Events" to if not (exists disk "ACB-External") then tell application "PowerKey Daemon" to set level of outlet 6 of unit "PKP" to 100
end mountExternal
…and unfortunatly useless for european plugs and 240V voltage
Oops - forgot about that :rolleyes:
ACB
On the other hand, a travel transformer is relatively inexpensive.
thanks a lot, Adam, this is very seductive, but the effort is to big to get all this stuff (also the plug-adaptors)