Re: Unwanted dialog if mounting fails
Re: Unwanted dialog if mounting fails
- Subject: Re: Unwanted dialog if mounting fails
- From: Jim Skibbie <email@hidden>
- Date: Wed, 29 Jul 2009 15:23:14 -0500
- Thread-topic: Unwanted dialog if mounting fails
Title: Re: Unwanted dialog if mounting fails
I think the issue is not determining when to mount the volume. The issue is when you want to mount the volume, but for whatever reason, the volume cannot be mounted (e.g., the remote volume you want to mount is on a server that is down). In the past, you would get an error while mounting that you could trap in a try block and then handle. With the introduction of the dialog box (is this new in Leopard?) you don’t get any error, but your script can timeout waiting for someone to answer the dialog box. If the script is on a headless Mac, what is the solution as there is no one looking at the screen and answering the dialog box?
My solution was to abandon the Scripting Addition’s mount command and go with a Unix command to make a folder and then make that folder a mount point to the volume you wanted. Something like:
set vol to "Fake Volume"
set Server_Path to "afp://fakeuser:fakepassword@fake.host.IP.address/"
set mount_url to (Server_Path & vol) as string
try
do shell script "mkdir -p /Volumes/" & quoted form of (vol as string)
do shell script "mount -t afp " & quoted form of mount_url & " /Volumes/" & quoted form of (vol as string)
on error errMsg number errNum
display dialog errMsg & return & errNum
end try
Jim
Date: Wed, 29 Jul 2009 06:56:04 +1000
From: Peter Baxter <email@hidden>
Subject: Re: Unwanted dialog if mounting fails
To: Applescript Users <email@hidden>
HI,
You don't need to load the volume to know if it is mounted. An alias
of the disk will be kept in the folder /volumes/ while if it is
loaded. Simply check if the alias is present in this folder and you
avoid the long wait in your script, and the problematical dialog. You
can then mount the volume only if it is missing.
Peter Baxter
On 28/07/2009, at 7:32 PM, Yvan KOENIG wrote:
>
>
> if exists volume xx then mount volume xx
>
> Yvan KOENIG (from FRANCE mardi 28 juillet 2009 11:32:35)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden