The best way to do this is to copy the text onto the SUT’s clipboard. For example, if the text that you want to verify is in a text box on the SUT, you should be able to select that text, either by clicking or double-clicking in the box, or dragging the mouse across it, or better yet through a menu command shortcut (e.g. cmd-A on a Mac). Then issue a copy command (cmd-C on Mac, ctrl-C on Windows, etc.) to copy that text to the clipboard. The text will then be available to your script by using the RemoteClipboard() function.
Here is some sample code that shows how this works:
-- click in the box (using an image of something outside the box)
-- select the text
-- copy the text to the clipboard
-- get the text from the SUT
get the RemoteClipboard -- (clipboard contents are now in 'it')
-- check the value
if it is not "ExpectedText" then
LogError "Wrong text!"
I hope this is helpful.