How to communicate a TerminalGetText Activity with a TerminalSession Activity to c# Custom Activity?


I would like create my own TerminalWaitScreenText Activity, because this curently UiPath’s activity is not adapted to the IBM Terminal.

In a first time, I have to use a TerminalGetText. However, I don’t know how to communicate this one with a TerminalSession Activity.

My approch is the following C# code:

namespace CATS
    public class WaitScreenText : CodeActivity
        public InArgument<UiPath.Terminal.TerminalConnection> ExistingConnextion { get; set; }

        public OutArgument<string> Result { get; set; }
        protected override void Execute(CodeActivityContext context)
            UiPath.Terminal.TerminalConnection v_existingConnextion = ExistingConnextion.Get(context);

            UiPath.Terminal.Activities.TerminalSession v_terminalSession = new UiPath.Terminal.Activities.TerminalSession();
            UiPath.Terminal.Activities.TerminalGetText v_terminalGetText = new UiPath.Terminal.Activities.TerminalGetText();

            v_terminalSession.ExistingConnection = v_existingConnextion;

            // v_terminalSession.Body.Argument.Set(context, v_existingConnextion);
            v_terminalSession.Body.Handler = v_terminalGetText;

            // WorkflowInvoker getTextInvoker = new WorkflowInvoker(v_terminalGetText);
            WorkflowInvoker getTextInvoker = new WorkflowInvoker(v_terminalSession);

            IDictionary<string, object> v_text3270 = getTextInvoker.Invoke();
            string v_result = v_text3270["Text"].ToString();
            Result.Set(context, v_result);

Error thrown is: ‘Literal’: Literal only supports value types and the immutable type System.String. The type UiPath.Terminal.TerminalConnection cannot be used as a literal.

If I use:

WorkflowInvoker getTextInvoker = new WorkflowInvoker(v_terminalGetText)

Error thrown is: Terminal error: NotConnected

If I use:

v_terminalSession.Body.Argument.Set(context, v_existingConnextion);

Error thrown is: DelegateArgument ‘terminalSession’ must be included in an activity’s ActivityDelegate before it is used.

Do you know how to communicate a TerminalGetText Activity with a TerminalSession Activity?

Thank a lot !