Re: Unmounting a Server Disk
Re: Unmounting a Server Disk
- Subject: Re: Unmounting a Server Disk
- From: Andy Wylie <email@hidden>
- Date: Fri, 20 Jul 2001 15:55:56 +1200
on 20/7/01 10:31 am, Nigel Garvey at email@hidden wrote:
>
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.
>
>
Perhaps OSA menu doesn't care for finder queries...
-------
if "Shared" is in (list disks) then --- list disks = Std Additions OSAX
tell application "Finder" to put away disk named "Shared" without asking
end if
-------
>
> 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.
>
>
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.
kinda but it seems to have to be outside the tell block...
-----------
input state {modifier keys:"C",keys down:"y"}
-----------
_____________________________ Andy