I would like to be able to grab the text of the most recent notification and pass it into an applescript variable. How can I do that?
Edit: here's what I have so far:
on run
tell application "System Events"
tell process "NotificationCenter"
tell first window
set rawElements to UI elements
end tell
end tell
end tell
end run
This gets me most of the way there, but it doesn't get me the body of the notification, just the label:
Here's the output:
{static text "Macro Cancelled" of window 1 of application process "NotificationCenter" of application "System Events", image 1 of window 1 of application process "NotificationCenter" of application "System Events", scroll area 1 of window 1 of application process "NotificationCenter" of application "System Events", image 2 of window 1 of application process "NotificationCenter" of application "System Events"}