Automating Terminal Emulation

image for article

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.

 Terminal Text

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.

 Pause Task

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

 Send Terminal Text

  • Next, an Action is used to change to a directory/folder called “terminalusers” with the Send Terminal Text Action and the “cd terminalusers” command.

 Terminal Text

  • The “ls” command is used to list the files in the “terminalusers” directory/folder, using the Send Terminal Text Action.

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 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. 

 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.

File System

  • This results in creating a text file called “Terminalusers.txt” with the lines containing text being written into the file.

 Terminal Users 

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.

The sample task can be downloaded here.


AutoMate Tips