I’m doing some UI scripting of the “New Outlook”, which basically broke Outlook’s actual AppleScript dictionary.
One thing I’d like to do is get the message body.
I’ve found a way to do it, but unfortunately there text content is spread across two different types of UI objects (group, static text) with an “AXWebArea” object (UI element 1 of a scroll area of…).
So, instead of being able to do something like this:
value of every static text of UI element 1 of…
I instead have to do something like this:
set msgTextObjects to UI elements of msgBodyArea
set msgTextBlock to ""
repeat with oneTextObject in msgTextObjects
if class of oneTextObject is group then
set oneBlock to value of static text of oneTextObject
else
set oneBlock to value of oneTextObject
end if
set msgTextBlock to msgTextBlock & return & oneBlock
end repeat
The problem is that when there are a lot of “paragraphs” (group or static text) within a message, that loop takes awhile, but the “value of every” method is much faster.
Any ideas on whether there is a faster way to do this?
I’ve thought about grabbing the “groups” and the “static texts” separately using the “every” method, then mixing them back together, hoping that a process that doesn’t make multiple requests to the Outlook app process would be quite a bit faster. One way to do that would be to coerce the “every” result into text, so that I can see in which order the groups and static text are nested. A bit of a hack, but might work.
Any better ideas on how to get the content of that AXWebArea as a single text block?