Terminal Session - change screen size

We use EHLLAPI Enhanced mode to automate IBM Personal Communications (TN3270)

  1. In initialization we open IBM P-COMM profile and then create new Terminal Session using default Connection string outputting Terminal.Connection variable

  2. In following workflows for Terminal Sessions we attach to existing Connection using the variable.

The problem is during step 1) terminal screen size is setup based on the current Terminal screen (Login screen resolution is 24x80), after login screen resolution changes to 32x80. But In uipath “terminal host” screen size is not refreshed resulting rows below 25 - 32 are not visible for UIPAth activities.
Activity Move Cursor to blind area (eg 27x40) works, but text activities are failing - get screen text(return only 24 rows), set field value (filed not found).

If we Login manually and navigate to another screen with 32x80 resolution and then create terminal session (step1) It is working fine. It means, screen area is defined during that step and not refreshed anymore.

Is there any method for Terminal.Connection object, we can refresh the resolution, or any atributes we can change?

I think we are having the same problem for a connection type of UiPath Internal (TN3270).
We need 27x132.

See the attached workflow with an example on how to change the screen size. Note that the attached example will not work as the connection is not properly set.
TerminalChangeScreen.xaml (9.1 KB)

1 Like


I tried the above and I configured my terminal connection to the settings I always use, but I receive a NullReferenceExeption stating that the expression with property ‘size’ cannot be created because the target object is null.

I copied your solution and I configured the terminal connections, what else can I do to solve this?

I added my project in attachment.

Thanks in advance!

Kr,test4.xaml (8.2 KB)


Hi ShirleyG,

For terminal activities - if you need to output terminal connection - there must be at least one activity in the sequence - e.g. - Send Control key (TAB), then TerminalConnection is created after TerminalSession Block is processed.

Thanks very much for the solution it works! But there is some issue. Invoke Method:ScreenChanged somehow interrupts workflow… It has to be last thing in the workflow, any activities after are ignored. E.g. If you put Write Line activity just after this invoke, it is ignored, even there is no error. This can be easily workaround, but it bit strange.

Hey, @Ada_CZ Thanks for you answer; I followed your advice to insert a flow in the sequence but I still receive the NullReferenceException, I created a new topic especially for this issue: NullReferenceException: cannot create an L-value from the given expression with property 'size' because the target object is null
I also added my adjusted worflow in the new topic.

I hope you or @Silviu know why the workflow still isn’t working for us.

Thanks in advance!


When you declare ScreenData Variable, as Default value set “new ScreenData”, seems this solve the issue

NOT CORRECT - see my other post

1 Like

Hey @Ada_CZ, @Silviu, the NullReferenceException is indeed solved! Thank you for your help, problem now is that our original problem is not solved with the adjustment of the size :cry:

I added a screenshot: we still receive: “error message CPF4169 appeared during OPEN (C G D F)”

Thanks for your help! We appreciate it a lot!


Hey just a quick update in case anybody else in the future encounters the same problem: we had a call with UiPath yesterday in order to solve the problem, they pointed out the cause of the issue but they cannot solve it because we have to change the default settings within our firm.

Thanks for info.

We realized we made it working by mistake.

If you move Assign Activity for ScreenData into TerminalSession sequence and set Continue on Error property of TerminalSession = True, then it works for us.

The solution i posted before (assign New ScreenData) prevents Error Message, but actual resolution is not changed.
At the moment, we do not know how to change screen size without ignoring errors.

Hey Ada_CZ,

I just wanted to let you know that we solved the problem: we use 3 terminal connections now, we added a third connection to the example of Silviu. In the second connection we just set a disabled sequence (when it’s enabled the flow doesn’t work), for us all problems regarding the screensize are completely solved.

Hope it works for you as well.


1 Like

Hello ShirleyG,
please could you be more specific, how you avoided error during:
assign “new ScreenSize(32, 80)”

Working component to the change screen resolution for terminal.connection
IBM_ScreenReSize.xaml (7.9 KB)

i am trying to connect w3270 terminal , i am getting issue with screen size , let me know how to configure screen size


see the screenshots I added in attachment:

  1. start AS400 proces ( I do it through an invoke)
  2. I determine my connections (conn brieven and conntarificatie: 2 because in the invoke I start 2 sessions)
  3. change the screensize (also explained in the above comments)
  4. use the invoke method to save the screensize
  5. then again a terminal connection (I filled it with a disabled message box, because it has to be filled), just to refresh the connection
  6. then the final terminal connection and the screensize is changed and you can work!

make sure the “close connection” checkbox is checked!


May i ask how did you fix this
Having the same error for as400 terminal.
Does this error have something to do with screensize? I tried resizing via ScreenData to no avail.

I tried as mentioned… but not working for me… Below are the steps done

  1. In 1st Terminal session, opened a connection using the connection string and contains a Send control key for Tab
  2. The above activity is followed by assign for setting screen size to screen data and an Invoke method for ScreenChanged
  3. 2nd terminal session with disabled activity
  4. 3rd terminal session contains other steps

Let me know if i missed anything… Thanks

Hello anyone solve this issue. if solved, please share test workflow