Skip to content

Commit

Permalink
Add error hanbling on clear notification applescript
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianriobo committed Apr 6, 2021
1 parent 1317cc0 commit 3f0a99f
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ set notificationAreaId to 1
set notificationWindow to "Notification Centre"
try
tell application "System Events"
tell window notificationWindow of process "NotificationCenter"
name
end tell
end tell
on error
tell application "System Events"
tell process "SystemUIServer" to click menu bar item notificationCenterIconIndex of menu bar systemMenuBarId
delay 0.25
delay 0.25
end tell
end try
try
tell application "System Events"
tell process "NotificationCenter"
tell (first button of UI Element 1 of row todayRowId of table notificationTableId of scroll area notificationAreaId of window notificationWindow whose value of attribute "AXDescription" is closeButtonAXDescription)
click
Expand Down

0 comments on commit 3f0a99f

Please sign in to comment.