Skip to content

Instantly share code, notes, and snippets.

@prenagha
Created November 5, 2012 15:16
Show Gist options
  • Save prenagha/4017693 to your computer and use it in GitHub Desktop.
Save prenagha/4017693 to your computer and use it in GitHub Desktop.
VPN toggle applescript for launchbar
--
-- applescript to toggle connection state of vpn
-- http://markupboy.com/blog/view/toggling-vpn-with-applescript
-- http://www.plankdesign.com/blog/2012/06/toggle-your-network-settings-with-launchbar/
--
tell application "System Events"
tell current location of network preferences
-- set this to the name of your VPN config
set VPNservice to service "vpn service name"
set isConnected to connected of current configuration of VPNservice
if isConnected then
disconnect VPNservice
else
connect VPNservice
end if
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment