Hello, I don't know much about AppleScript, but I found this script on a Raycast site that dismisses Notification Center notifications. It worked great on Sonoma but has stopped working in Sequoia. Here is the code:
tell application "System Events"
tell process "NotificationCenter"
if not (window "Notification Center" exists) then return
set alertGroups to groups of first UI element of first scroll area of first group of window "Notification Center"
repeat with aGroup in alertGroups
try
perform (first action of aGroup whose name contains "Close" or name contains "Clear")
on error errMsg
log errMsg
end try
end repeat
-- Show no message on success
return ""
end tell
end tell
When using this to attempt to dismiss notifications, it returns the following error:
Can’t get scroll area 1 of group 1 of window "Notification Center" of process "NotificationCenter". Invalid index. (-1719)
Please help me fix it so it will run in Sequoia! This script was super useful.