Skip to content

Instantly share code, notes, and snippets.

@mkearney
Forked from andrewh/anyconnect.scpt
Created September 12, 2019 21:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkearney/47d75ea52094f6ef9b4fd1ab340bf371 to your computer and use it in GitHub Desktop.
Save mkearney/47d75ea52094f6ef9b4fd1ab340bf371 to your computer and use it in GitHub Desktop.
Applescript to automate the Cisco AnyConnect SSL VPN client on OS X Mavericks
-- 1. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor
-- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password
-- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility
-- 4. Enable Applescript Editor and System UI Server
-- 5. Trigger script from the menu
-- 6. Enjoy being connected
tell application "Cisco AnyConnect Secure Mobility Client"
activate
end tell
repeat until application "Cisco AnyConnect Secure Mobility Client" is running
delay 1
end repeat
tell application "System Events"
repeat until (window 1 of process "Cisco AnyConnect Secure Mobility Client" exists)
delay 1
end repeat
tell process "Cisco AnyConnect Secure Mobility Client"
keystroke ("vpn.example.com" as string)
keystroke return
end tell
repeat until (window 2 of process "Cisco AnyConnect Secure Mobility Client" exists)
delay 1
end repeat
tell process "Cisco AnyConnect Secure Mobility Client"
keystroke ("redacted" as string)
keystroke return
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment