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: Thu, 30 Jul 2009 17:16:50 -0500
- Thread-topic: Unwanted dialog if mounting fails
Title: Re: Unwanted dialog if mounting fails
Bert-
You could try pinging the host server first to see if it’s available before you attempted to mount the volume. If you want, you could use the –t flag for ping to set a timeout to only wait so many seconds for a reply. If the handler returns true, the server is there and you could try to mount the volume. If it’s false, then you don’t need to try to mount it. Of course there could always be a firewall rule that could disallow a ping even though the server might be available, so this should be taken into consideration.
set host_address to "fake.IP.Host.Address"
set should_I_try_to_mount to PingHost(host_address, "3") --try to ping the server, max timeout = 3 seconds.
on PingHost(the_host, no_of_seconds_to_wait)
try
if (do shell script "ping -c1 -t" & quoted form of no_of_seconds_to_wait & " " & quoted form of the_host) contains "1 packets received" then
return true
else
return false
end if
on error errMsg number errNum
return false
end try
end PingHost
hth,
Jim
From: Bert Groeneveld
Subject: Re: Unwanted dialog if mounting fails
Hello Jim, I tested this smart workaround and it works great! Thank
you for your help!
Just one small complication:
Faking only the Volume name, almost immediately pushes the script into
the error block (I immediately get the dialog, as expected), but:
Faking the IP address (I changed it to an IP address that does not
exist in my local network) pushes the script only after 75 seconds
into the error block. This is not such a big problem of course, but I
thought it was a good idea to tell you. Who knows, probably you also
have a "solution" for this. I already tried to put the try block into
a timeout block of 10 seconds, but that didn't help.
Bert.
_______________________________________________
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