i’ve some problems with a handler that stopped to work yesterday, and returns me an “missing value”. Whats going wrong with my connection ? “connect VPNservice” doenst work anymore!
tell application "System Events" to tell network preferences
#properties
tell location "Pincopallino"
#properties
set VPNservice to service 1
if exists VPNservice is true then
try
log 1
connect VPNservice
set stat_cnn to true
on error
set stat_cnn to false
end try
end if
end tell
end tell
return stat_cnn
if the service does not exist the variable stat_cnn is never set.
This might be more reliable
tell application "System Events" to tell network preferences
#properties
tell location "Pincopallino"
#properties
try
set VPNservice to 1st service whose kind is 13 -- 13 is the numeric representation of VPN
log 1
connect VPNservice
return true
end try
return false
end tell
end tell
thanks for your suggestion, i like it.
I found the problem: My network service wasnt ranked as first service in my network location. Hmpf-incredible how such little annoyances can complicate life. Maybe i should review how connections work. For now i used only location and service - but i see there’s more. Dont know if these are things worthy to dig