Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
(*
Toggle GlobalProtect VPN with AppleScript
Tested using macOS 10.14 and GlobalProtect version 5.2.3-22
Written by Trevor Manternach, July 2021.
*)
tell application "System Events" to tell process "GlobalProtect"
click menu bar item 1 of menu bar 2 -- Activates the GlobalProtect "window" in the menubar
click button 2 of window 1 -- Clicks either Connect or Disconnect
click menu bar item 1 of menu bar 2 -- This will close the GlobalProtect "window" after clicking Connect/Disconnect. This is optional.
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment