System Events: Get the message or contents of window 1

Is there a way to get the message returned from an application’s alert window? I have searched to no avail. For example, assume Acrobat threw an alert, the alert doesn’t always have a “title” or a window name. So I was hoping there was a way to read the contents within the alert message so I could then determine how the script will behave, i.e., continue after the said alert window is closed or abort the script altogether where this snippet of code resides.

For example, this snippet will display the name of the window. But I was hoping somebody knows how to get the contents of the message itself of window 1? A message such as, “File ‘MyExampleFile.pdf’ was not split because it is already 1 page.”

tell application "System Events"
	tell process "Acrobat"
		set frontmost to true
		set theTitle to title of window 1
		display dialog theTitle as string
	end tell
end tell

Hi,

in a window text fields (static text) contains text


tell application "System Events"
	tell process "AdobeAcrobat"
		set message to value of static text 1 of window 1
	end tell
end tell

Ugh. You have got to be kidding me. I can’t believe that is all it took. Stefan, I can’t thank you enough for taking the time to reply to my question.