Trying out auto-mounting network shares with AppleScript
I wanted a neater way of auto-mounting network shares on startup than simply sticking the path in Login items so I thought I'd search around and see what methods were available. I finally settled on using a bit of AppleScript to first check if the mount point exists and, if not, to attempt to mount the network share. 1 2 3 4 5 6 7 8 9 tell application "Finder" if not (exists POSIX file "/Volumes/Data" ) then try mount volume "afp://some-server.local/Data" end try else display dialog "Already Mounted" end if end tell Given that I wanted to mount multiple shares, putting the above in a function seemed like the way to go. Unfortunately, no matter what I tried, passing the path to Finder as a variable caused the test to always fail - even though though the path could be displayed via dialog as well as appearing in the AppleScript Editor's Events box. After finally giving up on that, I switched ...