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
1
u/tsmith944 Nov 26 '20 edited Nov 26 '20
I found this also, but it doesn't work. Maybe someone knows how to update the code for Big Sur?
https://medium.com/flawless-app-stories/clearing-all-notifications-in-mac-os-x-3be0a16eb2a3
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
1
u/[deleted] Dec 18 '20
[removed] — view removed comment