r/applescript • u/tsmith944 • Nov 20 '20
Clear all notifications with single script on Big Sur?
During my workflow I end up with a ton of notifications and in Big Sur it's a pain to close each one by either swiping away or clicking the tiny X.
Does anyone know how to batch clear notifications?
I saw this script, but it doesn't work in Big Sur, I get an error where it can't "get button 'Close' of window 1 of process 'NotificationCenter'":
tell application "System Events"
tell process "NotificationCenter"
set numwins to (count windows)
repeat with i from numwins to 1 by -1
click button "Close" of window i
end repeat
end tellend tell
12
Upvotes
View all comments
1
u/crazycreach Jan 07 '21
This is the JS AppleScript I use to clear all notifications. Note that you can also change the
appNamevariable if you only want to close notifications for a specific app.https://gist.github.com/lancethomps/a5ac103f334b171f70ce2ff983220b4f