With the release of Big Sur, my scripts for keyboard control of macOS notification alerts stopped working. With a bit of experimentation and help from Google, I have written new ones. Closing an alert To close a notification alert on Big Sur, conceptually we want to press the X button that appears when you hover over it. The AppleScript to do this is:
activate application "NotificationCenter"
tell application "System Events"
tell process "NotificationCenter"
set theWindow to group 1 of UI element 1 of scroll area 1 of window "Notification Center"
# click theWindow
set theActions to actions of theWindow
repeat with theAction in theActions
if description of theAction is "Close" then
This is much more complicated than just clicking button 1 of… continue reading.