Last active
November 14, 2020 04:58
-
-
Save jenikm/999eacaf62353e53ec13e5dcc3396f6e to your computer and use it in GitHub Desktop.
Dismiss notifications - MacOS: Big Sur
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
#!/usr/bin/env osascript | |
tell application "System Events" | |
tell process "NotificationCenter" | |
tell window 1 | |
tell scroll area 1 | |
tell UI element 1 | |
tell group 1 | |
if exists then | |
set current_mouse_xy to (do shell script "/usr/local/bin/cliclick p") | |
set dialog_xy to position | |
set dialog_x to (item 1 of dialog_xy) | |
set dialog_y to (item 2 of dialog_xy) | |
do shell script "/usr/local/bin/cliclick m:$((" & dialog_x & "+50)),$((" & dialog_y & "+25))" | |
try | |
click button "Close" | |
end try | |
try | |
click button "Clear All" | |
end try | |
do shell script "/usr/local/bin/cliclick m:" & current_mouse_xy | |
end if | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Depends on:
brew install cliclick