Posted By

iloveitaly on 07/04/10


toggle mac applescript connection os x connect vpn disconnect

Versions (?)

Toggle VPN Connection

 / Published in: AppleScript

  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  

You need to login to post a comment.