Freitag, 6. Februar 2015

Apple script to connect to AFP network shares with password prompt

I have Synology NAS and thus connect several folders as network shares.
Since the connection often gets lost, especially after the Mac is going to sleep I wrote a little script.
The script prompts for password so you don't have to expose it.
Enjoy ;)


display dialog "Password to connect to NAS" default answer ""
set nas_pw to text returned of result
try
mount volume "afp://username:" & nas_pw & "@nas_ip_or_dns/photo"
mount volume "afp://username:" & nas_pw & "@nas_ip_or_dns/home"
mount volume "afp://username:" & nas_pw & "@nas_ip_or_dns/music"
mount volume "afp://username:" & nas_pw & "@nas_ip_or_dns/video"
mount volume "afp://username:" & nas_pw & "@nas_ip_or_dns/share"
end try