Skip to content

Instantly share code, notes, and snippets.

@bezhermoso
Created January 15, 2016 16:29
Show Gist options
  • Save bezhermoso/2a1ee72399bbb7b925e4 to your computer and use it in GitHub Desktop.
Save bezhermoso/2a1ee72399bbb7b925e4 to your computer and use it in GitHub Desktop.
Handly AppleScripts to manage OS X notifications. (Use in Automator, bind to keyboard shortcuts via BetterTouchTool, etc.) Inspired by http://apple.stackexchange.com/a/155736
my closeNotifications()
on closeNotifications()
tell application "System Events"
tell process "Notification Center"
set theWindows to every window
repeat with i from 1 to number of items in theWindows
set this_item to item i of theWindows
try
click button 1 of this_item
on error
my closeNotifications()
end try
end repeat
end tell
end tell
end closeNotifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment