Automate VPN Application Login


I'm trying automate the process of logging into a VPN application on a Mac. I have do to it manually with these steps right now:

  1. Launch the VPN application
  2. Click on the 'Connect' button
  3. Enter my email and password
  4. Copy/Paste a login token from another app (Authy)
  5. Paste it into the VPN application
  6. Click connect

I got past Step 1, but stuck on Step 2. If I use Mouse Click, it doesn't work when I connect to an external monitor (because the screen resolution is different?). Is there a better alternative to Mouse Click? I played around with Found Image but can't figure it out.

If anyone has automated something similar, or just general advise and tutorials, please let me know. As a newbie I'm not quite sure where I should be searching for.



Hi Andy,

I do that with the Image trigger. I refer there to a image that I see on the screen when I log in into my Cisco AnyConnect VPN client, see the copy of the KM macro enclosed.

Of course you also should set your own password.

Kind regards –

Cisco VPN einschalten.kmmacros (47.0 KB)

I did something similar with ExpressVPN and AppleScript but it didn't require entering a password or using other applications besides AppleScript. Keyboard Maestro can be the trigger mechanism.

Mine required:

  1. Launch the VPN application.
  2. Select "Location" to connect to.
  3. Click on the 'Connect' button.