It is a follow-up to a publish made about 2 years in the past to make use of Apple Script to modify between Wi-Fi networks through the menu bar:
Massive Sur 11.1: AppleScript to Routinely Change Wi-Fi Networks
My previously-working script now simply returns “lacking worth”:
inform software "System Occasions" to click on (each menu bar merchandise of menu bar 1 of software course of "ControlCenter" whose title begins with "Wi‑Fi")
inform software "System Occasions" to click on (each UI ingredient of scroll space of group 1 of window "Management Heart" of software course of "ControlCenter" whose title begins with "YOUR_SSID_HERE")
It appears macOS Ventura broke my beforehand answer fairly badly. I am unable to even use “get properties” to make any sense of of what the hierarchy of UI components needs to be anymore. Eg:
inform software "System Occasions" to click on (each menu bar merchandise of menu bar 1 of software course of "Management Heart" whose description begins with "Wi‑Fi")
delay 3
inform software "System Occasions" to get properties of UI components of scroll space 1 of group 1 of window "Management Heart" of software course of "Management Heart"
Consequence:
{{minimal worth:lacking worth, orientation:lacking worth, place:{2061, 76}, class:UI ingredient, accessibility description:lacking worth, function description:"heading", targeted:lacking worth, title:lacking worth, measurement:{102, 15}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXHeading", worth:lacking worth, subrole:lacking worth, chosen:lacking worth, identify:lacking worth, description:"heading"}, {minimal worth:lacking worth, orientation:lacking worth, place:{2052, 95}, class:checkbox, accessibility description:lacking worth, function description:"toggle button", targeted:lacking worth, title:lacking worth, measurement:{288, 32}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXCheckBox", worth:0, subrole:"AXToggle", chosen:lacking worth, identify:lacking worth, description:"toggle button"}, {minimal worth:lacking worth, orientation:lacking worth, place:{2061, 141}, class:UI ingredient, accessibility description:lacking worth, function description:"heading", targeted:lacking worth, title:lacking worth, measurement:{99, 15}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXHeading", worth:lacking worth, subrole:lacking worth, chosen:lacking worth, identify:lacking worth, description:"heading"}, {minimal worth:lacking worth, orientation:lacking worth, place:{2052, 160}, class:checkbox, accessibility description:lacking worth, function description:"toggle button", targeted:lacking worth, title:lacking worth, measurement:{288, 32}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXCheckBox", worth:0, subrole:"AXToggle", chosen:lacking worth, identify:lacking worth, description:"toggle button"}, {minimal worth:lacking worth, orientation:lacking worth, place:{2052, 192}, class:checkbox, accessibility description:lacking worth, function description:"toggle button", targeted:lacking worth, title:lacking worth, measurement:{288, 32}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXCheckBox", worth:1, subrole:"AXToggle", chosen:lacking worth, identify:lacking worth, description:"toggle button"}, {minimal worth:lacking worth, orientation:lacking worth, place:{2052, 224}, class:checkbox, accessibility description:lacking worth, function description:"toggle button", targeted:lacking worth, title:lacking worth, measurement:{288, 32}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXCheckBox", worth:0, subrole:"AXToggle", chosen:lacking worth, identify:lacking worth, description:"toggle button"}, {minimal worth:lacking worth, orientation:lacking worth, place:{2052, 267}, class:UI ingredient, accessibility description:lacking worth, function description:"disclosure triangle", targeted:false, title:lacking worth, measurement:{288, 22}, assist:lacking worth, total contents:{}, enabled:true, most worth:lacking worth, function:"AXDisclosureTriangle", worth:0, subrole:lacking worth, chosen:lacking worth, identify:lacking worth, description:"disclosure triangle"}}
That is whole gibberish to me and does not record any clear UI components with any identify or description attributes that time to a selected Wi-Fi SSID. I additionally discover a ton of “lacking worth” strings. By comparability, utilizing Accessibility Inspector and clicking on my desired SSID within the community record, it claims it has the beneath attributes:
Attributes:
AXParent: “”
AXRoleDescription: “toggle button”
AXChildren: “”
AXIdentifier: “wifi-network-MYSSID”
AXPath: “Path 0x600003016d90:
”
AXAttributedDescription: “MYSSID, safe community, 3 bars{
AXATextAlignmentValue = 0;
AXFont = {
AXFontFamily = ".AppleSystemUIFont";
AXFontName = ".SFNS-Common";
AXFontSize = 13;
AXVisibleName = "System Font Common";
};
AXForegroundColor = [ (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; Generic RGB Profile)] ( 0 0 0 0.847059 );
}”
AXEnabled: “1”
AXSubrole: “AXToggle”
AXRole: “AXCheckBox”
AXWindow: “”
AXValue: “1”
AXChildrenInNavigationOrder: “”
Actions:
AXPress - press
I am actually actually stumped right here and have been making an attempt to work on this for hours. I simply cannot for the lifetime of me determine which baby ingredient inside “scroll space 1” I needs to be utilizing. Any concepts?
Thanks.