Last active
September 16, 2015 13:17
-
-
Save digiltd/17b8da6cad0b6ad86ac0 to your computer and use it in GitHub Desktop.
Toggle the VPN on OSX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
tell current location of network preferences | |
set VPN to "Private Internet Access" | |
set VPNactive to connected of current configuration of service VPN | |
if VPNactive then | |
disconnect service VPN | |
say "The VPN has been disconnected" | |
display notification "VPN Disconnected" with title "Toggle VPN" | |
else | |
connect service VPN | |
say "You are now connected to the VPN" | |
display notification "VPN Connected" with title "Toggle VPN" | |
end if | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment