2

I've been using an AppleScript for connecting to my office VPN. After updating my macbook to 10.9.3, it fails to execute, and throws an exception

Unable to get network preferences

(honestly, it is loose translation, if anyone know how to make AppleScript editor to show errors in english I would be glad).

Whole code:

tell application "System Events"
    tell current location of network preferences
        set VPNservice to service "VPN (L2TP)" -- name of the VPN service
        if exists VPNservice then connect VPNservice
        repeat until (connected of current configuration of VPNservice)
            delay 1
        end repeat
        do shell script "route add 192.168.11.0/24 10.64.64.64" with administrator privileges
    end tell
end tell

Does anyone know what could have caused the problem?

  • You need to try and break down the code to see where the error is coming from. I do not have any VPN setup. But I did a test with only the two tell blocks and the set VPNservice to service "VPN (L2TP)" -- name of the VPN service I used Wi-fi instead. The if exist, repeat block and do shell removed. I got results. Do the same and see if you do. This is one way of narrowing down the problem. Also A.S normally jumps to the problem line and you can look in the events, replies panel to see what is happening – markhunte May 25 '14 at 23:44

You must log in to answer this question.

Browse other questions tagged .