Hi
I'm new to apple, but have a rudmentary programming background, and I'm trying to get the script to work with no joy ..
I have created the following script but nothing happens when I run it - other than the running icon for 50 seconds?
Is there anything else I need to set in the apple environment for it to run - I have a Macbook air 2014
Presumably it should create, and I should see, mount points in the named directory
set NrMounted to 0
set MaxMount to 4 -- 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 "T******" -- 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("Music") then set NrMounted to NrMounted + 1
if MountedSuccessfull("TV Series") then set NrMounted to NrMounted + 1
if MountedSuccessfull("New") then set NrMounted to NrMounted + 1
if MountedSuccessfull("Videos") 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 "Media:password"
set NASIP to "Office-PC"
set MountPointFolder to "/Users/julieanne/Media/" -- I have created this directory in Finder
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 presumably 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 //" & serverAddress & " " & mountPoint
set Mounted totrue
end timeout
end if
end try
end tell
return Mounted
end MountedSuccessfull