Last active
March 2, 2021 10:32
-
-
Save buggymcbugfix/a040f290a8dd139d9b56ffb2043f2568 to your computer and use it in GitHub Desktop.
Connect to FortiClient VPN
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
-- Connect to FortiClient VPN. Uses of `delay` here are nothing short of an ugly HaCk. | |
-- You may need to adjust the delays to work on your system. Also make sure with your | |
-- sysadmin that it is ok to hard-code your password (see below*) as THIS IS NOT SECURE. | |
-- !!!USE THIS SCRIPT AT YOUR OWN RISK!!! | |
-- trick taken from [1] to avoid long GUI delay | |
ignoring application responses | |
tell application "System Events" to tell application process "FortiClientAgent" | |
click menu bar item 1 of menu bar 2 | |
end tell | |
end ignoring | |
delay 0.1 | |
do shell script "killall 'System Events'" | |
delay 0.1 | |
tell application "System Events" to tell application process "FortiClientAgent" | |
click menu item 2 of menu 1 of menu bar item 1 of menu bar 2 | |
delay 0.6 | |
keystroke "my-$ecret-pa$$word" -- (*) | |
click UI element "Connect" of window 1 | |
end tell | |
-- [1]: https://stackoverflow.com/a/16497564 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment