Este es el script:
tell application "System Events"
tell process "NotificationCenter"
set numwins to (count windows)
repeat with i from numwins to 1 by -1
tell window i
set temp to value of static text 1
end tell
if temp contains "Disk Not Ejected Properly" then
click button "Close" of window i
end if
end repeat
end tell
end tell
Y este es el error que recibo:
error "System Events got an error: Can’t get static text 1 of window 1 of process \"NotificationCenter\". Invalid index." number -1719 from static text 1 of window 1 of process "NotificationCenter"
Estoy usando MacOS Big Sur 11.4