Skip to content

Instantly share code, notes, and snippets.

@uchm4n
Last active September 26, 2018 20:33
Show Gist options
  • Save uchm4n/547921823d3df6ae3aca4489471795a1 to your computer and use it in GitHub Desktop.
Save uchm4n/547921823d3df6ae3aca4489471795a1 to your computer and use it in GitHub Desktop.
Automatically fill Cisco AnyConnect credentials on mac
-- automatically fill Cisco AnyConnect credentials on mac
set targetApp to "Cisco AnyConnect Secure Mobility Client"
set vpnName to "yourVPNServer.com"
set pass to "YOURPASSWORD"
set loginWindowTitle to "Cisco AnyConnect | " & vpnName
tell application targetApp
activate
end tell
repeat until application targetApp is running
delay 1
end repeat
tell application "System Events"
repeat until (window 1 of process targetApp exists)
delay 1
end repeat
tell process targetApp
keystroke return
end tell
repeat until (window loginWindowTitle of process targetApp exists)
delay 1
end repeat
tell process targetApp
keystroke pass
keystroke return
end tell
-- Waiting for "Cisco AnyConnect - Banner" window
repeat until (window "Cisco AnyConnect - Banner" of process targetApp exists)
delay 1
end repeat
keystroke return
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment