Created
June 30, 2016 19:20
-
-
Save boinger/714c8bde0a04ba58e938ae2b88b5e5f7 to your computer and use it in GitHub Desktop.
This file contains 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
#! /usr/bin/osascript | |
set appname to "Pulse Secure" | |
set dialogappname to "PulseTray" | |
tell application appname | |
if it is not running then | |
activate | |
end if | |
end tell | |
tell application "System Events" | |
tell process appname | |
tell menu "File" of menu bar item "File" of menu bar 1 | |
tell menu "Connections" of menu item "Connections" | |
if (exists menu item "Cancel") then | |
tell me to say "Would have cancelled" | |
delay 1 | |
end if | |
if (exists menu item "Disconnect") then | |
tell me to display notification "Disconnecting VPN connection" | |
click menu item "Disconnect" | |
delay 1 | |
end if | |
repeat until exists menu item "Connect" | |
tell me to display notification "Waiting for connection to close" | |
delay 10 | |
end repeat | |
click menu item "Connect" | |
end tell | |
end tell | |
end tell | |
end tell | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment