Skip to content

Instantly share code, notes, and snippets.

@boinger
Created June 30, 2016 19:20
Show Gist options
  • Save boinger/714c8bde0a04ba58e938ae2b88b5e5f7 to your computer and use it in GitHub Desktop.
Save boinger/714c8bde0a04ba58e938ae2b88b5e5f7 to your computer and use it in GitHub Desktop.
#! /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