I am trying to write an AppleScript to connect to a VPN service. Once connected to the VPN, I want to display the VPN icon in the status area of the menu bar.
I've gotten as far as
- connecting to VPN
- displaying the Network section of System Preferences
but I am unable to select the Service. How do I do that?
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.network"
tell application "System Events" to tell process "System Preferences" to tell window "Network"
-- code to select the VPN Service "XYZ" and click the "Show VPN Status in menu"
end tell
end tell