Are you able to help me? I want the exact same functionality you do so I decided to use your script, but every time I try to go and save it as an application using AppleScript, I get a Syntax error Expected "end" but found unknown token.
I'm not a programmer, so am not able to self debug. 😕
All I've been able to do so far is Launch Apple Script Editor and pasted the script following =========== below and tried to hit save. Can you help me understand what I'm doing wrong please?
===========
set NrMounted to 0
set MaxMount to 2 -- max number of networkshares to mount
set NrTries to 0
set MaxTries to 5 -- max tries before quit
repeat while NrMounted is not MaxMount and NrTries is not MaxTries
set theWifi to "VancityGuyWifi" -- the wifi SSID
set theList to paragraphs of (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s| awk '{print $1}'") -- get the wifi list
set EthernetStatus to do shell script "ifconfig en0 | grep 'status' | cut -d ':' -f 2 | tr -d ' '" -- get ethernet status
if theList contains theWifi or EthernetStatus = "active" then
if MountedSuccessfull("Volume_1") then set NrMounted to NrMounted + 1
if MountedSuccessfull("Volume_2") then set NrMounted to NrMounted + 1
end if
set NrTries to NrTries + 1
delay 10 -- waiting time before next try
end repeat
on MountedSuccessfull(VolumeName)
set NASUserCredentials to "username:password"
set NASIP to "100.100.100.2"
set MountPointFolder to "/Users/Vancityguy/NAS/"
set Mounted to false
set serverAddress to NASUserCredentials & "@" & NASIP & "/" & VolumeName
set mountPoint to MountPointFolder & VolumeName
tell application "Finder"
try
if disk VolumeName exists then -- it's presumable already mounted
else
with timeout of 3 seconds -- try to mount
do shell script "[ ! -d " & mountPoint & " ] && mkdir -p " & mountPoint & " || echo directoryOK" -- create the folder to host the mount point if it doesn't already exist
do shell script "mount -t smbfs /
set Mounted to true
end timeout
end if
end try
end tell
return Mounted
end MountedSuccessfull