AppleScripts not working on new System Settings on MacOS Ventura

Hello. I update my iMac to MacOS Ventura and sadly I realized that scripts that previously worked on old Systems Preferences on macOS Monterey and earlier, now stopped working on new System Settings on MacOS Ventura. Even If I want do something simple like: “get id of current pane”, Apple Script throwing an error said that “AppleEvent handler failed.” System Settings are on dictionary though so this is a bug or I must something allow on new system?

It is known issue. Apple may fix it in next major OS release. But it will not be fixed in macOS 13.x.
Why? Because it is Apple.

Today, I wrote System Settings control library to display each pane by Pane title.
I’ll deliver it as a additional supplement script to my ebook.

For simply opening a Settings pane, this seems to be possible (though not with AppleScript).

See the most recent comments here:

1 Like

You can use the x-apple values from AppleScript like this:

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use framework "AppKit"
use scripting additions

current application's NSWorkspace's sharedWorkspace()'s openURL:(current application's NSURL's URLWithString:"x-apple.systempreferences:com.apple.preferences.password")
3 Likes

Here you go. You can split the System Settings tell at splitter group 1 and use group 2 to interact with the actual setting for the pane. If you don’t have Family enabled then the indices maybe be off by 1.

use framework "Foundation"

property pane_ids : {|AppleID|:2, |Family|:3, |Wi-Fi|:5, |Bluetooth|:6, |Network|:7, |Notifications|:9, |Sound|:10, |Focus|:11, |Screen Time|:12, |General|:14, |Appearance|:15, |Accessibility|:16, |Control Center|:17, |Siri & Spotlight|:18, |Privacy & Security|:19, |Desktop & Dock|:21, |Displays|:22, |Wallpaper|:23, |Screen Saver|:24, |Battery|:25, |Lock Screen|:27, |Touch ID & Password|:28, |Users & Groups|:29, |Passwords|:31, |Internet Accounts|:32, |Game Center|:33, |Wallet & ApplePay|:34, |Keyboard|:36, |Trackpad|:37, |Printers & Scanners|:38, |Java|:40}

on open_settings_to(settings_pane)
    set pane to current application's NSDictionary's dictionaryWithDictionary:pane_ids
    set pane_index to (pane's valueForKey:settings_pane) as anything
    tell application "System Settings"
        activate
        delay 1
    end tell
    tell application "System Events"
        tell application process "System Settings"
            tell outline 1 of scroll area 1 of group 1 of splitter group 1 of group 1 of window 1
                select row pane_index
            end tell
        end tell
    end tell
end open_settings_to