Automating Terminal Emulation | Fortra

Automating Terminal Emulation

Posted on March 3, 2013
Sample Task Terminal Emulation

This month’s sample task demonstrates how to use the Automate Terminal Emulation Actions to interact with a terminal system and import the data from the system into a file.  Integration is a huge part of automation as company’s access terminal systems to circulate data across multiple platforms.  A terminal server can be anything from a text terminal/green screen that utilizes TCP/IP, Telnet, SSH, or any other vendor specific network protocol with a common connection to a network.  With Automate and the  Automate BPA Server, terminal servers can be used to run programs, save files, and employ network resources working as a bridge to connect terminal and/or legacy systems to Windows networks and computers.   

Automate communicates with terminals over TCP/IP or SSH connections.  Our software emulates ANSI, TTY, VT50’s, VT100’s, VT220’s, VT320’s, TN3270’s, and TN3278 IBM mainframes. 

In this task, we will show you how Automate connects to a terminal server, logs in, changes the directory/folder, list the files in the folder, extracts the content from the terminal window, loops through the content, and writes the lines containing the files list to a text file. 

Here is how the Sample Terminal Emulation Task is configured:

  • The first step connects to the terminal server using the Connect Terminal Action and TCP/IP Connection Type using Port 23.  Notice the “Show Terminal Window” option is selected below:

Connect Terminal
  • ANSI Emulation is used and configured under the Advanced tab.

Terminal Emulation
  • The next Action logs into the terminal server by entering the user login name with the Send Terminal Text Action.

Send Terminal Text Username

NOTE:  A two-second pause is added to the task to wait for the terminal server to move the cursor to the area on the screen where the password is entered.

2 Second Pause Text
  • The Send Terminal Text Action is used again to enter the password.

Terminal Text Password
  • Next, an Action is used to change to a directory/folder called “terminalusers” with the Send Terminal Text Action and the “cd terminalusers” command.
  • The “ls” command is used to list the files in the “terminalusers” directory/folder, using the Send Terminal Text Action.

ls send terminal text
  • When the task has run, the terminal window should look like the window below:

Terminal Window
  • Next, the Wait Terminal Action is used to wait for specific text to appear on the screen before moving on.  In this instance, we are waiting for the welcome screen to appear after logging on.  There is also a one-minute timeout setting.  A Pause Task Action can also be used here instead of the Wait Terminal Action.

Wait Terminal
  • The Get Terminal Text Action is used to get and extract the content of the entire screen and place all of the information into a variable called “VAR_terminaltext”.

Get Terminal Text
  • Now a Loop List Action is used to loop through the “VAR_terminaltext” variable, one line at a time using a variable called “VAR_terminallines”, to hold the lines from the terminal text. 


Loop List
  • An If Text Contains Logic Action is added to the task to look at the “VAR_terminallines” variable for text anywhere in the line. 


Action Properties Window- If Text Contains
  • If the terminal line contains text, the next step writes the line to a text file called “terminalusers.txt” into the c:\test\ directory\folder using the File System, Write to File Action, appending it to the end of the file as it loops through the data.

Action Properties Window -File System
  • This results in creating a text file called “Terminalusers.txt” with the lines containing text being written into the file.


Action Properties Window - Terminal users window

The information written into the text file is ready for review and/or further processing.  

Although this is a simple task extracting data from a terminal window and writing it into a  text file, Automate can write or import terminal text into CSV files, databases, spreadsheets, SharePoint, and more.

Additionally, the same way Automate extracts data from a terminal session, it can also integrate data extracted from a file, database, spreadsheet, or application and enter it into a terminal session.

Ready to see how business process automation can benefit your organization?