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 or create a new Desktop Automation robot.

  2. Open an existing project or create a new project (in Smart Re-Execution (Full) mode) and add a new robot with a Call Desktop Automation Robot step. Specify the name of the Desktop Automation robot opened by this step.
  3. 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).
  4. Execute the Call Desktop Automation Robot step and click the Step Into DA Robot button on the toolbar.

  5. In the Desktop Automation workflow, add the Terminal step with necessary parameters. In this tutorial we connect to the 5250 terminal. Generally, the connection string is as follows: tn5250://<hostname>:<portnumber>?env.TERM=<terminal type>. Note that env.TERM parameter is valid for the tn5250 terminal only.
    • Emulator: iSeries(tn5250)

    • Action: Connect

    • Host: terminal5250_server:11623

    • Options: env.TERM=IBM-3477-FC

    Where terminal5250_server is the terminal name or IP address, and :11623 is the terminal connection port number. If we omit the env.TERM parameter, the emulator connects 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 Terminal step, leave the Desktop Automation robot, refresh your Web Automation robot with the Call Desktop Automation Robot step in Design Studio, and click Step Into DA Robot. If you re-run the robot without closing the terminal, another terminal window opens and the robot may fail to execute.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. To log in, right-click the terminal in the Recorder View and select Press Key (Enter by default).
  11. 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.
  12. 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 Web Automation robot. Click Step Into.

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