• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Mounting volumes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mounting volumes


  • Subject: Re: Mounting volumes
  • From: Alex Zavatone <email@hidden>
  • Date: Fri, 20 Feb 2015 10:58:32 -0500

I've seen it back all the way to 10.6.x.

Sent from my iPad. Please pardon typos.

On Feb 20, 2015, at 6:25 AM, Jörgen Stahle <email@hidden> wrote:

This happens in some cases with smb-volumes, not afp-volumes, and is not new to Yosemite.
I don’t know if it is possible to disable the dialog from the system.

Instead, i handle it by first check the availability of the server with a ping call before I mount it. (That has several advantages.)

Like this:

--? if myVolume is not in (list disks)
if pingServerOK(myServer) then
mount volume "smb://" & myServer & "/" & myVolume as user name myUsername with password myPassword
else if pingServerOK(myAlternativeServer) then
-- etc
else
-- etc
end if
-- end

on pingServerOK(serverIPorDNS)
set okIndicator to "0.0% packet loss"
set oldOKIndicator to " 0% packet loss" --obs: mellanslag först
set pingString to "ping -c 1 -t 5"
set pingFullCommand to pingString & " " & serverIPorDNS
set ping_result to (do shell script pingFullCommand)
if ping_result contains okIndicator or ping_result contains oldOKIndicator then
return true
else
return false
end if
end pingServerOK





19 feb 2015 kl. 19:29 skrev Stockly, Ed <email@hidden>:

Thanks RJ and Jörgen.

Here's what I've got, but there is an issue. If the server or volume can't mount a system error dialog appears, that isn't trapable and doesn't clear after a couple minutes or with an apple event time out. (This is a bug, no?) It happens in Yosemite, don't know about other versions.

The script this will live is designed to run unattended and if the volume isn't available it mounts a different volume. If that's not available is logs the error and continues.

———————
property myUsername : ""
property myPassword : ""
property myServer : "SeverName"
property myVolume : "VolumeName"

TryToMountTheServer()
on TryToMountTheServer()


try
mount volume "smb://" & myServer & "/" & myVolume as user name myUsername with password myPassword
return
on error
set dialogReply to display dialog "Volume Didn't Mount, re-enter username?" & return & return & ¬
"Username:" default answer myUsername ¬
buttons {"Change Username", "Cancel", "No change"} ¬
default button 1 ¬
with title ¬
"Change Username" giving up after 60


if button returned of dialogReply is "Change Username" then
set myUsername to the text returned of dialogReply
end if
set dialogReply to display dialog "Volume Didn't Mount, re-enter password?" & return & return & ¬
"Password:" default answer myPassword ¬
hidden answer true ¬
buttons {"Change Password", "Cancel", "No change"} ¬
default button 1 ¬
with title ¬
"Change Username" giving up after 60


if button returned of dialogReply is "Change Password" then
set myPassword to the text returned of dialogReply
end if
end try


end TryToMountTheServer
  ---------------------------







_______________________________________________
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





       
<image001.png>

JÖRGEN STAHLE

Sidproduktionsansvarig
IT

Gjörwellsgatan 30
112 88 Stockholm
070-372 44 46
tt.se

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
References: 
 >Mounting volumes (From: "Stockly, Ed" <email@hidden>)
 >Re: Mounting volumes (From: RJay Hansen <email@hidden>)
 >Re: Mounting volumes (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Re: Encoding
  • Next by Date: Finder Passing Copies of Folders Rather than the Originals
  • Previous by thread: Re: Mounting volumes
  • Next by thread: Encoding
  • Index(es):
    • Date
    • Thread