Activate / De-activate VPN per AppleScript

Just got a good Deal for a VPN Provider to different countries to secure Wireless Connections via VPN Unlimited.

Link to deal https://deals.cultofmac.com/?rid=199289 , offers  expires 2014/08/22

I don’t want to keep it running by default so I created a short script to activate / de-activate the VPN via Keyboard Maestro.

Keyboard Maestro Editor VPN Switch

and here the script:

tell application "System Events"
    tell current location of network preferences
        set VPNservice to service "VPN Unlimited (Germany)"
        set isConnected to connected of current configuration of VPNservice
        if isConnected then
            disconnect VPNservice
            set onOff to "off"
        else
            connect VPNservice
            set onOff to "on"
        end if
    end tell
end tell
return onOff

I now just need to figure out how to use more than one profile (the profile is auto configured via an app).

Still if this VPN Provider works to my satisfaction I guess I will subscribe longer after the first 3 years.

Advertisements

2 thoughts on “Activate / De-activate VPN per AppleScript

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s