Het is een kleine modificatie. Ik geef hem hier voor de volledigheid.
(*
Mount shares to the desktop. Finder will ask for a password the first time.
You than can choose to store it in the keychain to let it automount the next time.
Duplicate the "mount_share" command to add more shares.
*)
mount_share("smb", "account", "nasnaam.local", "sharenaam-1")
mount_share("smb", "account", "nasnaam.local", "sharenaam-2")
on mount_share(protocol, account, server, share)
create_mountpoint(share)
set PW to getPW(server, account)
set Fx to "mount_" & protocol
if protocol = "smb" then set Fx to "mount_smbfs"
set x to 0
-- try a few time in case the server has to wake up first.
-- don't do anything if the share is already mounted
repeat until x > 4 or mounted_shares() contains "mountpoint_" & share
tell application "Finder"
set myscript to Fx & " " & protocol & "://" & account & ":" & PW & "@" & server & "/" & share & " ~/mountpoint_" & share
try
do shell script myscript
on error
--display dialog myscript
set x to x + 1
delay 30
end try
end tell
end repeat
end mount_share
on mounted_shares()
tell application "System Events" to get the name of every disk whose free space > 1
end mounted_shares
on create_mountpoint(share)
set mounted to do shell script "test -d ~/mountpoint_" & share & " && echo yes || echo no"
if mounted = "no" then
do shell script "mkdir ~/mountpoint_" & share
else
do shell script "echo 'mounted'"
end if
end create_mountpoint
on getPW(server, account)
do shell script "security 2>&1 >/dev/null find-internet-password -a" & account & " -gs " & server & " | awk '{print $2}'"
return (text 2 thru -2 of result)
end getPW
Dit script genereert voor elke share een lege folder in je user folder op de mac die als mount-point dient. Ik weet nu echter niet of het een meerwaarde heeft op het eerste script.