Last active
August 29, 2015 14:12
-
-
Save lotreal/ce43f4a85d8ae73781fa to your computer and use it in GitHub Desktop.
anyconnect.scpt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 0.3 | |
end repeat | |
tell application "System Events" | |
repeat until (window 1 of process "Cisco AnyConnect Secure Mobility Client" exists) | |
delay 0.3 | |
end repeat | |
delay 0.3 | |
tell process "Cisco AnyConnect Secure Mobility Client" | |
-- keystroke ("host" as string) | |
keystroke return | |
end tell | |
repeat until (window 2 of process "Cisco AnyConnect Secure Mobility Client" exists) | |
delay 0.3 | |
end repeat | |
set ConnectAnyway to button 2 of window 1 of process "Cisco AnyConnect Secure Mobility Client" | |
click ConnectAnyway | |
repeat until (window 2 of process "Cisco AnyConnect Secure Mobility Client" exists) | |
delay 0.3 | |
end repeat | |
tell process "Cisco AnyConnect Secure Mobility Client" | |
-- keystroke ("username" as string) | |
keystroke return | |
end tell | |
repeat until (window 2 of process "Cisco AnyConnect Secure Mobility Client" exists) | |
delay 0.3 | |
end repeat | |
tell process "Cisco AnyConnect Secure Mobility Client" | |
keystroke ("521198" as string) | |
keystroke return | |
end tell | |
repeat until (window 1 of process "vpndownloader" exists) | |
delay 0.3 | |
end repeat | |
set ConnectAnyway to button "Connect Anyway" of window 0 of process "vpndownloader" | |
-- properties of ConnectAnyway | |
click ConnectAnyway | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment