Skip to content

Instantly share code, notes, and snippets.

@ubermajestix
Created December 9, 2013 20:56
Show Gist options
  • Save ubermajestix/7880713 to your computer and use it in GitHub Desktop.
Save ubermajestix/7880713 to your computer and use it in GitHub Desktop.
This script allows you to open your vpn connection by launching an application. I use it to connect to a vpn from Alfred (you could use Quicksilver or LaunchBar too). In Automator, search for the "Run AppleScript" action. Double click it and copy and paste the code below. Change your vpn's name on line 3. Then export to your Applications folder …
tell application "System Events"
tell current location of network preferences
set VPNservice to service "yourVPN"
if exists VPNservice then set isConnected to connected of current configuration of VPNservice
if isConnected is false then
connect VPNservice
else
disconnect VPNservice
end if
end tell
end tell
Copy link

ghost commented Jun 3, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment