How To Find The Current Cursor Position Using Native Terminal Activities?

How to find the current cursor position using native Terminal activities?

Root Cause:

  • Currently, there is no activity predefined in UiPath to retrieve the cursor position. Thus this can be achieved with code.
  • Sometimes network lag or slowness in response will cause unexpected results. Hence adding a timeout in the connection method will help resolve the issue.

Resolution: Currently, there is no activity predefined in UiPath to retrieve the cursor position. Thus this can be achieved with code.

Follow the below steps:

  1. Upgrade the UiPath.Terminal.Activities to 2.7.3 using this source https://pkgs.dev.azure.com/uipath/Public.Feeds/_packaging/UiPath-Official/nuget/v3/index.json

  1. Save the Terminal connection (OutputConnection property for the terminal session) into a variable ("conn")
  2. Assign: int row =
conn.GetScreen(new UiPath.Terminal.Data.CommandOptions()).Cursor.Row
  1. Assign: int col =
conn.GetScreen(new UiPath.Terminal.Data.CommandOptions()).Cursor.Column


Alternative Solution: In some cases adding timeout will help as below,

ScreenData screen = GetScreen(new UiPath.Terminal.Data.CommandOptions(1000))
int column = screen.Cursor.Column
int row = screen.Cursor.Row 
4 Likes

Hi mate,

If you can move the cursor on desired screen area on AS400, then you can use the “Get Field at position” activity and it retrieves the Row and Column.

Cheers,

Get Field at Position does not get the row and column. The row and column are inputs telling it where to look for the field, and it gets the value in the field.

Hi,

I tried to use this, but the value is always 1 in row and column.
Is there another way to get the position?

Im using VT terminal

Regards :⁠-⁠)

Hi Miguel,

Were you able to resolve this?

Regards :slight_smile:

Hi,

not yet, i just want to be sure where the bot need to write.

Any resolution on this?

Just use the Move Cursor activity to put it where you want it.

I have the same basic problem here. We have a screen that is built dynamically on the mainframe and we want to tab to each field down a column and clear the data before putting in new data based on input to the Performer.

We have been using the terminal session GetScreen to get cursor location as we know, when the column number changes, we have gone through all the fields that we wanted to clear.

This has been working for us until an upgrade of the Terminal Activities package to the latest Windows version and now we only get values of 1 for the row and the column.

Hey MalBee. I was wondering if you had a resolve on this situation? We are experiencing the same issue and getting FieldNotFound error so wanting to know if there are any alternative options or an outcome :slight_smile:

Facing the same issue while trying to get current cursor position. has there been a resolution for the same ? Anyone able to figure this out?

In my testing, the last Terminal Activities that worked was 2.4.1. Everything since 2.5.0 seems to have a problem.

Don’t have a solution yet, but have reached out to UiPath and raised a support ticket.

1 Like

Thanks for that - will have a look at which version we are running. Are you facing the FieldNotFound terminal error when the cursor can’t be found also?

We don’t normally use fields information, but I did notice that it wasn’t returning any for me either when I was testing the rows and columns function. So in short, yes, there seems to be something amiss.

To get this logic to work you need to pass in a parameter within the CommandOptions() like so conn.GetScreen(new UiPath.Terminal.Data.CommandOptions(1000)).Cursor.Row

2 Likes