Created
March 3, 2018 00:50
-
-
Save mbierman/3618e1bed8ee800f9dffc8941765c79b to your computer and use it in GitHub Desktop.
Notifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clears all of the notifications on the mac.