Re: Unmounting a Server Disk
Re: Unmounting a Server Disk
- Subject: Re: Unmounting a Server Disk
- From: Nigel Garvey <email@hidden>
- Date: Thu, 19 Jul 2001 23:31:03 +0100
Eric Sackett wrote on Tue, 17 Jul 2001 17:33:31 -0400:
>
I'm trying to unmount a disk in the Finder by AppleScript. The only way I
>
see is to use the "put away" command. I'm using Mac OS 9.1 and AS 1.6.
>
>
So I have:
>
>
tell application "Finder"
>
if (exists disk "Shared") then
>
put away disk "Shared" without asking
>
end if
>
end tell
>
>
This works great when run from Script Editor, but when run from OSA Menu as
>
a compiled script, I get an error that the AppleEvent timed out. Once I
>
dismiss the dialog, the disk is removed from the desktop.
>
>
It's as if the Finder is waiting for something after it puts away the disk.
>
It doesn't happen, so it times out even though it has already put away the
>
disk.
>
>
Any ideas? TIA.
Fredo's already suggested putting the script in a 'try' block, but that
way you still have to wait for the timeout to expire. Another way - if
you don't mind using a third-party OSAX - is to simulate the Command-"y"
key-press. This produces an almost instantaneous result:
tell application "Finder"
activate
if (exists disk "Shared") then
select disk "Shared"
TypeText "y" with Command -- needs Sandi's Additions
end if
end tell
I believe that something similar is possible with Akua Sweets. To be
honest, though, by the time you've selected the script in OSA Menu, you
may as well select the disk icon and press Command-"y" for real. :-)
NG