Skip to content

Instantly share code, notes, and snippets.

@jayjanssen
Created December 20, 2013 14:26
Show Gist options
  • Save jayjanssen/8055465 to your computer and use it in GitHub Desktop.
Save jayjanssen/8055465 to your computer and use it in GitHub Desktop.
tell application "System Events"
tell current location of network preferences
set VPNservice to service "My VPN" -- name of the VPN service
if exists VPNservice then connect VPNservice
repeat until (connected of current configuration of VPNservice)
delay 1
end repeat
end tell
end tell
-- throws this error on 10.9.1 (worked on 10.9.0)
-- error "System Events got an error: Can’t get network preferences." number -1728 from network preferences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment