Connect to a Network with AppleScript
Hi,
I'm trying to build a script to connect to a network (School VPN) already configured in System Preferences.
However I can't make the script to select the proper network configuration in the table on the left (Image).
I want the script to
- Open System Preferences -> Network
- Click on the 5th network configuration.
- Click on connect.
I've written this script but when I compile it, it returns "missing value".
tell application "Finder"
open file "Macintosh HD:System:Library:PreferencePanes:Network.prefPane"
end tell
--Here says "missing value"
tell application "System Events" to tell process "System Preferences"
click static text 1 of row 5 of table 1 of scroll area 1 of window 0
end tell
--Now the script needs to click button "connect"
quit application "System Preferences"
Any idea on how could I make this work?
MacBook Pro 16″, macOS 12.0