Skip to content

Instantly share code, notes, and snippets.

@mbierman
Created March 3, 2018 00:50
Show Gist options
  • Select an option

  • Save mbierman/3618e1bed8ee800f9dffc8941765c79b to your computer and use it in GitHub Desktop.

Select an option

Save mbierman/3618e1bed8ee800f9dffc8941765c79b to your computer and use it in GitHub Desktop.
Notifications
my closeNotif()
on closeNotif()
global activeApp
tell application "System Events"
set activeApp to name of first application process whose frontmost is true
-- set theDialogText to "The curent app is " & (activeApp)
-- display dialog theDialogText
-- --> Result: {button returned:"OK"}
end tell
tell application "Finder"
activate
end tell
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 closeNotif()
end try
end repeat
end tell
end tell
end closeNotif
tell application activeApp
activate
end tell
@mbierman
Copy link
Author

mbierman commented Mar 3, 2018

Clears all of the notifications on the mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment