I wrote a script a while back that utilizes this format to mount volumes on the desktop:
mount volume "afp://userName:password@155.155.155.155/driveName"
There are only two Mac’s on the network with the other Mac having an external hard drive, the user, and the main hard drive. I have the script set up to check for mounted volumes and make a list, excluding those already mounted, of all volumes that can be mounted. If no volumes are already mounted the first volume usually mounts without any problems. If I used the script and then tried to mount a second volume, sometimes it works with out problems and other times it errors saying that some disk could not be found. Sometimes, even though the disk “could not be found” it mounted anyway.
I don’t know what has happened recently, but the format used above results in a spinning beach ball, Finder freezes, and I have to relaunch the Finder. (The ip address is still correct on the machine to be mounted)
I just used this format
mount volume "afp://hardDrive.local./volumeName" as user name "user" with password "password"
without having the freeze problem, but have the same problem as above with the error. When the error came up I tried connecting through the Network (the hard way ) and the volume I tried to mount was greyed out, but was not actually mounted on my desktop. So I thought that maybe the desktop needs to be updated after an operation so I included this
tell application "Finder" to update desktop
after mounting the volume I wanted, but this does not seem to help. Is this correct for updating the desktop? Has anyone else had a similar problem? Any ideas would help. Thanks
Full code:
set diskList to list disks
set mountedVols to {} as list
set volList to {"OWC Neptune", "Macintosh HD G51", "admin1", "CromaPro"}
set cnt to count diskList
display dialog "Do you wish to mount or dismount volumes?" buttons {"Mount", "Dismount"} default button "Mount"
set butChoice to button returned of the result as text
if butChoice is "Mount" then
if cnt is not 6 then
repeat with i from 1 to 4
if diskList does not contain item i of volList then
set mountedVols to mountedVols & item i of volList
end if
end repeat
tell application "Finder"
choose from list mountedVols with prompt "Choose volume/s to mount."
set choice to result as text
if choice is "volume1" then
mount volume "afp://hardDrive1.local./volume1" as user name "uName" with password "pass"
tell application "Finder" to update desktop
else if choice is "volume2" then
mount volume "afp://hardDrive1.local./volume2" as user name "uName" with password "pass"
tell application "Finder" to update desktop
else if choice is "volume3" then
mount volume "afp://hardDrive1.local./volum3" as user name "uName" with password "pass"
tell application "Finder" to update desktop
else if choice is "hardDrive" then
mount volume "afp://uName:pass@155.155.155.155/hardDrive"
end if
end tell
else
display dialog "All volumes are currently mounted."
end if
else
my dismountVol()
end if
on dismountVol()
tell application "Finder"
eject every disk
tell application "Finder" to update desktop
end tell
end dismountVol
PreTech