How To Wait Until Window Contents Contain A String?

I’m automating logon and a few other things in the TN3270 mainframe host terminal emulator.

Today I put in arbitrary pauses between the steps - so, for example, giving the logon screen 1.5 seconds to appear before blasting it with content.

I’d like to be able instead to wait for the window’s text to contain a particular string. (The user interface is entirely character string driven.

Is there a way to do that? I’d like to make it reusable so I can wait for different strings to appear on different screens.

Any thoughts?

In the unlikely event that the app is AppleScriptable, that might be an approach.

Otherwise, your options would be to pause until an image to appear on the screen and use an image of the text, or perhaps to repeatedly do a Select All, Copy until the words appear in the clipboard.

Thanks. I assume:

  1. This approach is reusable - different character string each time.

  2. It’s possible to time out and abort the macro.

Yes if you use copy. If you use the screen image, you'd need to take a screenshot of each possible text you want to search for.

Yes, actions have timeouts.