Created
March 9, 2023 09:20
-
-
Save ftabashir/b94336c7d4a21c4cd22433c332f69984 to your computer and use it in GitHub Desktop.
This file contains 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/osascript | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title Close all background items added notifications | |
# @raycast.mode compact | |
# Optional parameters: | |
# @raycast.icon 🔕 | |
tell application "System Events" | |
tell process "NotificationCenter" | |
set frontmost to true | |
set numwins to (count windows) | |
repeat with i from numwins to 1 by -1 | |
tell window i | |
set numg to (count group) | |
repeat with j from numg to 1 by -1 | |
tell scroll area of group j | |
tell every UI element of first UI element | |
set cc to (every UI element whose Value is "Background Items Added") | |
if count of cc is 1 | |
perform action "AXPress" | |
end if | |
end tell | |
end tell | |
end repeat | |
end tell | |
end repeat | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unfortunately I didn't find a way to close notifications, instead this script simply clicks them. So a settings window will appear after running this script.
If you know a way to fix this, please let me know.