Im using Sierra so this works for me but i'd like to specify to only reconnect when the particular network is active. The following isn't quite functioning. Any idea's whats wrong?
on idle
set mySSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"
if ((mySSID as string) is equal to "SSID NAME”) then
tell application "System Events"
tell current location of network preferences
set myConnection to the service “MYVPNNAME”
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
return 4
end tell
end if
end idle
Im using Sierra so this works for me but i'd like to specify to only reconnect when the particular network is active. The following isn't quite functioning. Any idea's whats wrong?
on idle
set mySSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"
if ((mySSID as string) is equal to "SSID NAME”) then
tell application "System Events"
tell current location of network preferences
set myConnection to the service “MYVPNNAME”
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
return 4
end tell
end if
end idle