"Close All Notification Alerts / Notification Center" is not working on macOS Sequoia 15.0

@HackettLai @asgeirtj

I fixed the script to also close Stacked (group) notifications:

tell application "System Events" to tell application process "NotificationCenter"
	try
		perform (actions of UI elements of UI element 1 of scroll area 1 of group 1 of group 1 of window "Notification Center" of application process "NotificationCenter" of application "System Events" whose name starts with "Name:Close" or name starts with "Name:Clear All")
	end try
end tell

The difference is that I added or name starts with "Name:Clear All" in the whose query.


Note:

Andreas pointed out that this script only works for English macOS localization. I haven't figured out how to account for non-English localization.

In any case, Andreas' script works great too!

When using Andreas' script, don't forget to add your Shared Secret! i.e.

tell application "BetterTouchTool" to trigger_action "{ BTTPredefinedActionType: 289}" shared_secret "your_shared_secret"
1 Like