1

I do not believe that macOS PPPC on Ventura and higher will permit this, but:

Is there a way to use AppleScript (osascript) to open Safari's Preferences window and change focus to Websites > Notifications?

Other web browsers can be easily scripted to show the notifications section of their settings, ie: $ open -a "Google Chrome" chrome://settings/content/notifications

This would be useful to assist an end user with disabling problematic/fake notifications.

1
  • Have you tried UI scripting?
    – nohillside
    Commented Oct 29, 2023 at 17:04

1 Answer 1

0

I tested this following AppleScript on macOS 14.1.

I think this is as close as you will be able to get with code. However, I was not able to select "Notifications"

if application "Safari" is running then
    tell application "System Events" to tell application process "Safari"
        set frontmost to true
        keystroke "," using {command down} -- opens Safari Settings window
        repeat until button "Websites" of toolbar 1 of front window exists
            delay 0.1
        end repeat
        click button "Websites" of toolbar 1 of window (get title of front window)
    end tell
end if

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .