Best way to find text on screen and move cursor to that text in terminal

I am working on converting bots to Uipath that have heavy usage on AS 400 emulators. I am able to connect and go through screens just fine with the terminal activities. My problem lies in certain screens where I need to read the screen and move the cursor to the text found on the screen. For example, when I log into the terminal I am asked which department I would like to choose. The screen has an option for 10 different departments, each on a different line. I want to build the bots dynamically as the screen has the potential to change(either add or remove departments). I have tried the various OCRs and the terminal get text, but that does not give me the coordinates of the text. Is the best way to read to use get text at position starting at the first department and then using If statements to go through the list until I reach what I am after? Any suggestions would be greatly appreciated.


for terminal emulation create dynamic robot is not easy. I made few robots with used ibm 3650 connection. But in my case I had constant screen.
We don’t have too much activity to choose. I can suggest only try ‘get field/text at position’
if you will get text which you looking for - you can move the cursor (I guess) to position on the same row. It depends on what your screen looks like.

Hi Piotr,

For clarification, this is an IBM i Access Client running on Windows 10. We use the IBM EHLLAPI to connect. When using the various OCR engines it targets the whole screen and not just the specific text in the screen we are looking for. I’m attaching one of the screens where we need to search for a certain number then select which one we want. With our current RPA provider, that we are converting from, they have the ability to search the screen and move the cursor to the start of the text found. This is crucial for banks as we deal with many legacy systems that have emulators for back end operations.

department capture


I wrote a custom activity that does this. Here’s the logic:

Get Text to get all text from the screen
Assign stringRow and stringCol both -1 for later validation
For Each row in Split(screenText,vbCrLf)

  • If row.Contains(stringToFind): Assign stringRow = index + 1, Assign stringCol = row.IndexOf(StringToFind) + 1, Break

If it never finds the string, then stringRow and stringCol will both still be -1, so you can use an If to check for that and determine if the string was found.

Now you have stringRow and stringCol that tell you where the first letter of your string is, and can use Move Cursor to go there.

You don’t use OCR for mainframe stuff. The mainframe activities contain everything you’ll ever need. Don’t attach to the Window and try to use regular activites, always use Terminal Session and terminal activities.

Also, the third party clients are unreliable. You should try Direct Connection (the built-in UiPath terminal client) - it’s faster and more stable than third party connections like IBM EHLLAPI.

Hi Paul,

Thanks for the suggestion. I got the stringCol to return the proper column, however the stringRow is way off. It is returning 0 when it should be returning 13 in my example. I think the issue may be with the Assign stringRow = index + 1. If I try using index I get a complier error. Instead I was using stringrow + 1. Is there a variable or some parameter I need to set correctly. My For each is TypeArgument = String.


I tried the Direct Connection, and others. Nothing works besides the IBM EHLLAPI connection for our system. I either get an error connecting, or it’s just a blank screen but says connected at the bottom.

Make sure you go into the Properties of the For Each, create a variable (I called mine index but you can call the variable whatever you want), and put the variable into the Index property.

This is why you aren’t getting a proper value for the row index, you have to explicitly tell For Each which variable to put the index into.


That is likely a settings issue related to the various options on the Direct Connection screen.

These settings could be the culprit:


I knew I was missing something obvious. Thank you. This worked perfectly to find the position of the key word. I then used a back tab to select the department I wanted. I’ll continue to work on that Direct Connection suggestion. I’m thinking it’s either the encoding or the LU Name as I have no clue what either would be.


I’ve never had to populate LU Name. I think the most likely culprit is the Enable SSL/TLS option. Maybe your mainframe requires it.

Our connection is set to No for TLS/SSL. I tried enabling it and it never connects. There were a couple options that I tried that says connected when you start the recorder, but any action does not display with the recorder and just throws an error once you send a Transmit. From what I’ve read this is because the IBM iAccess is java based.


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.