Toggle VPN Connection


/ Published in: AppleScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. on toggle_vpn()
  2. tell application "System Events"
  3. repeat with s in services of network preferences
  4. if kind of s is 14 then -- 14 is VPN
  5. if not connected of configuration of s as boolean then
  6. tell s to connect
  7. else
  8. tell s to disconnect
  9. end if
  10. end if
  11. end repeat
  12. end tell
  13. end toggle_vpn

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.