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.
-
Open an existing or create a new Robot .
- Open an existing project or create a new project (in Smart Re-Execution (Full) mode) and add a new Basic Engine Robot with a Call Robot step. Specify the name of the Robot opened by this step.
- 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).
-
Execute the Call Robot step and click the Step Into Robot button on the toolbar.
- In the Robot 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.
To re-run your Robot workflow for a terminal with a Terminal step, leave the Robot, refresh your Basic Engine Robot with the Call Robot step in Design Studio, and click Step Into Robot. If you re-run the robot without closing the terminal, another terminal window opens and the robot may fail to execute. -
- 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.
- Right-click the User ID field in the terminal in the Recorder View and select Step Into to type this text into the text field. and select the variable that contains the user name. Click
- To shift to the Password field, add the Press Key step and in the Key field select Step Into. The cursor should move to the Password field. . Click
- Right-click the Password field in the terminal window and select Step Into. and select the variable with the password. To actually type this text into the text field, click
- To log in, right-click the terminal in the Recorder View and select Press Key (Enter by default).
- 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.
- 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
> <variable
name>. 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> <binary variable name>. Later you can convert the information from the binary variable to an image in your Basic Engine Robot. Click Step Into.
Once you extract the information from the terminal, you can return to the Basic Engine Robot Editor window and use the extracted information.