Skip to content

Instantly share code, notes, and snippets.

@buggymcbugfix
Last active March 2, 2021 10:32
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 buggymcbugfix/a040f290a8dd139d9b56ffb2043f2568 to your computer and use it in GitHub Desktop.
Save buggymcbugfix/a040f290a8dd139d9b56ffb2043f2568 to your computer and use it in GitHub Desktop.
Connect to FortiClient VPN
-- 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