Alfred 3 to start/stop VPN connections using Shimo


#1

In my job I frequently need to switch VPN connections and it’s very cumbersome to use the Cisco client because it refuses to allow pasting a password in the password field or even keep a list of the most recent used configurations.
Shimo is an awesome app that allows you to configure various VPN connections including passwords (stored in Keychain). So life got better.

Today I decided to up the game and check if Shimo can be automated. It can: https://feingeist.freshdesk.com/support/solutions/articles/6000161011-establishing-a-vpn-connection-using-apple-script

So I wrote an Applescript and added that to an Alfred Workflow. In the image of the applescript in Alfred, the green bars are the names of the connections in Shimo. The red bars are variable names that represent the strings, e.g. set workVPN to “My VPN connection at work”. And then ‘set acc to workVPN’ later on in the if statement block.

I chose some letters here that are easy for me to remember for each of the VPN connections, but they can be chosen any way you want.
I’ve chosen ‘c’ to close all connections, but of course simply closing Shimo would do the job as well.

You start the Alfred workflow with ‘vpn’ followed by the letter of the VPN connection.

I hope this helps someone.


#2

Just as an aside… one of my favorite Keyboard Maestro macros is also one of the simplest:

I made a macro which will “Insert Text By Typing” and then told it to use %CurrentClipboard% which is Keyboard Maestro’s way of referencing the system clipboard.

Then I mapped that macro to option + V

It’s handy for those fields in apps or web pages which block ⌘V… and ⌥V is easy to hit when you’re already at ⌘V, which is why I chose it. If ⌘V doesn’t work, ⌥V will!