tell application "System Events"
try
set _groups to groups of UI element 1 of scroll area 1 of group 1 of window "Notification Center" of application process "NotificationCenter"
repeat with _group in _groups
set _actions to actions of _group
repeat with _action in _actions
if description of _action is in {"Close", "Clear All"} then
perform _action
end if
end repeat
end repeat
end try
end tell
What I tried
quit - restart KM
restart Mac
checked permissions in automation KM System Events
If you don't get help here, try feeding your script to an AI with a leading comment like "This script no longer works in macOS Sequoia," and see what it recommends.
They're not artificially intelligent, but sometimes, they're right. I'd always take someone's work here over the AIs, though ... but if you don't get any help, it's a good path of last resort.
@Nige_S ‘s script modification works but unfortunately only once in perhaps 20 tries.
@griffman’s great idea to use chatGPT. I tried a series of scripts proposed by chatGPT and one of them works perfectly. The script is below and the actual chat which is full of comments about notifications in Sequoia which may interest you.
I would be grateful if you could just look at the chatGPT script to make sure it’s OK and that I am not messing up my Mac settings or something else.
the script that works in KM does not work when the macro is triggered by Stream Deck (error message below)
interestingly this problem (inability to close notifications) coincided with 2 other issues
the Better Touch Tool "close all notifications" also stopped working which perhaps suggests it is a sequoia problem, not a KM problem.
a ne bizarre and extremely irritating issue that arose at the same time as the notification problem is that Better Touch Tool no longer triggers KM macros using the KM macro’s AppleScript. I have to change for shell scripts.
thank you both VERY much !!
chatGPT script that works
tell application "System Events"
tell process "NotificationCenter"
try
-- Make sure the Notification Center window is actually there
if exists window "Notification Center" then
-- This is the new path that works on Sequoia
if exists scroll area 1 of group 1 of group 1 of window "Notification Center" then
perform (actions of UI elements of ¬
UI element 1 of scroll area 1 of group 1 of group 1 of ¬
window ¬
"Notification Center" whose name starts with ¬
"Name:Close" or name starts with "Name:Clear All")
end if
end if
end try
end tell
end tell
error message when I trigger the KM macro with Stream Deck
2025-12-02 19:51:39 Action 100309032 failed: Execute an AppleScript failed with script error: text-script:212:213: script error: Expected end of line, etc. but found “"”. (-2741)
2025-12-02 19:51:39 Execute an AppleScript failed with script error: text-script:212:213: script error: Expected end of line, etc. but found “"”. (-2741). Macro “Clear Close all Notifications $wip” cancelled (while executing Execute AppleScript).
The ChatGPT script is structured differently but essentially does the same -- the biggest difference is that it targets actions by name rather than description. Those underlying accessibility tags often change across OS releases, so watch for similar at your next update!
For the KM error -- your AppleScript has a missing (or an extra) double-quote somewhere. You should see that in the macro's AS Action -- it won't compile and will remain in plain text rather than being formatted prettily. Make sure you Copy/Paste the AS in its entirety, completely replacing whatever was there in the Action before.
We can't say much else without having the actual macro to test -- but do make sure your Stream Deck button is calling the new, ChatGPT-scripted, macro and not a previous version!
You've an Action ID in that log entry -- do a search in the Editor, with the "All Macros" Smart Group selected, for action:100309032 to go to the problem Action and its containing macro.
There is a striking difference (IMO): the previous version cleared notifications one at a time which could a bit time consuming when there were many notifications, whereas the new chatGPT version just wipes them all out in a split second.
It's essentially the same in that it clears all clearable Notifications rather than just the first -- there's no repeat structure, which might throw people, the "loop" is buried in the pluralism ...UI element*s* of....
The chatGPT solution usually works (perhaps 80% success) so I did more testing and found a less elegant but much simpler and failsafe solution that I tested many times.
I am enclosing the images below and not the macro because the actual macro depends on screen size and pixels.
It uses the fact that if you click on the date an image appears, and if you click on the "x" below that image, you have direct access to clear all notifications (using ↓ x 2). At the end, keypress Escape