Basic Terminal Tutorial

See Automate Terminals for information on terminal prerequisites and settings.

In this tutorial we will connect to a 5250 terminal, login, run some commands, and extract information from the terminal.

  1. Open an existing project or create a new project (in Smart Re-Execution (Full) mode) and add a new Desktop Automation step.
  2. Add variables that will contain a login name and a password to log in to terminal. Also add a variable that will contain the output text. Add the variable with the output to the Return step (=textVariableName).
  3. In the Desktop Automation editor, add the Open step with the following parameters:
    • Name: specify any name
    • Reuse: leave as is
    • Device: local
    • URI of the terminal
    In this tutorial we connect to the 5250 terminal. Generally, the connection string is as follows: tn5250://<hostname>:<portnumber>?env.TERM=<terminal type>. We will use the following connection string: tn5250://Kapow_5250terminal:11623. Note that env.TERM parameter is valid for the tn5250 terminal only.

    Where tn5250 is the terminal type, Kapow_5250terminal is the terminal name or IP address, and :11623 is the terminal connection port number. We omitted the env.TERM parameter to connect to a default terminal type (IBM-3179-2). See Supported tn5250 Driver Terminals in the Automate Terminals.

    Note To re-run your Desktop Automation Workflow for a terminal with an Open step, close the Desktop Automation Editor, refresh your project in Design Studio, and open the Desktop Automation step again. If you re-run the robot without closing the terminal, another terminal window opens and the robot may fail to execute.
    Click Step Into to execute a step.
  4. If the terminal needs an Enter key press, right-click the terminal in the Recorder View and select the Press Key step. By default it selects Enter as a key.
  5. Right-click the User ID field in the terminal in the Recorder View and select Enter Text > From Variable > login and select the variable that contains the user name. Click Step Into to type this text into the text field.
  6. To shift to the Password field, add the Press Key step and in the Key field select Standard Keys > Tab. Click Step Into. The cursor should move to the Password field.
  7. Right-click the Password field in the terminal window and select Enter Text > From Variable and select the variable with the password. To actually type this text into the text field, click Step Into.
  8. To log in, right-click the terminal in the Recorder View and select Press Key (Enter by default).
  9. If the terminal needs an Enter key press, right-click the terminal in the Recorder View and select Press Key. By default it selects Enter as a key.
  10. After you execute the required commands, you can extract the information from the terminal window. To extract a text line, right-click a row, select Extract Context into > variableName. Click Step Into. The Variables branch in the Workflow State view shows the value you extracted.

    To take a screen shot of the entire terminal window (you need to add a binary variable to the Return step (=binaryVariableName) beforehand), select the screen element in the Recorder View and click Extract Image into > binaryVariableName. Later you can convert the information from the binary variable to an image in your website robot. Click Step Into.

Once you extract the information from the terminal, you can return to the website robot editor window and use the extracted information.