Terminal - Send Text
Description: Sends text to the terminal starting at the current cursor position during an established Terminal session. This action can be set to wait until the terminal is ready to receive the next command before sending text.
Practical Usage
Used to send text into an existing terminal session that was previously created by Connect Terminal action. The terminal actions are used in leu of terminal emulation software. Using the terminal actions, legacy systems can be automated in the background without the use of third-party software.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Text |
Text |
Yes |
(Empty) |
>Smith</AMSENDTERMTEXT> |
The text to send to the terminal. For example, if the terminal prompt was requesting a last name, this parameter could be "Smith" (no quotes). |
Session Name |
Text |
No |
TermSess1 |
SESSION="MyTermSession" |
The session name to send this text to. This session name must have been previously created with a prior Connect Terminal step. This allows several connections to be active simultaneously. If you are only using one connection at a time, you can leave this parameter set to the default value -TermSess1. |
Wait for default prompt |
Text (options) |
No |
Do not wait |
WAITFORDEFAULTPROMPT="BEFORE" |
Specifies whether task execution should pause before and/or after text is sent to the terminal and wait for the appearance of the default prompt. Often, this option is needed to cause the task to wait until the terminal is ready to receive the next command before sending text. The available options are:
|
Terminal Function Keys
Function keys on a terminal may either generate short fixed sequences of characters or the characters they generate may be configured by sending special character sequences to the terminal. On a standard computer keyboard, the function keys may generate a fixed, single byte code, outside the normal ASCII range, which is translated into some other configurable sequence by the keyboard device driver or interpreted directly by the application. The following list contains function keys that this activity can use to send to the terminal by simply enclosing them with curly brackets {} (e.g., {ENTER})
Function of Key |
Key |
---|---|
APL |
Ctrl+F8 |
Attention |
Esc |
Alternate Cursor |
Alt+F11 |
Backspace |
Backspace |
Back Tab |
Shift+> |
Back Tab Word |
Alt+< |
Break |
Break |
Change Format Toggle |
Alt+F3 |
Change Screen |
Ctrl+PageUp |
Clear |
Pause |
Color Blue |
Ctrl+Shift+F5 |
Color Field Inherit |
Ctrl+Shift+F8 |
Color Green |
Ctrl+Shift+F3 |
Color Pink |
Ctrl+Shift+F2 |
Color Red |
Ctrl+Shift+F1 |
Color Turquoise |
Ctrl+Shift+F6 |
Color White |
Ctrl+Shift+F7 |
Color Yellow |
Ctrl+Shift+F4 |
Cursor Blink |
Ctrl+F10 |
Cursor Down |
V or 2(pad) |
Cursor Left |
- or 4(pad) |
Cursor Right |
-> or 6(pad) |
Cursor Select |
Ctrl+F9 |
Cursor Up |
^ or 8(pad) |
Delete Character |
Delete
or |
Delete Word |
Ctrl+Delete or Ctrl+. (period on the number keypad) |
Document Mode Toggle |
Alt+F1 |
Dup |
Shift+Insert2 |
Edit Copy |
Ctrl+Insert |
Edit Cut |
Shift+Delete |
Edit Paste |
Shift+PageDown or Ctrl+Shift+Insert |
Edit Undo |
Alt+ Backspace |
End Field |
Pad End |
Enter/Control |
Shift+Ctrl |
Erase EOF |
End2 |
Erase Field |
Shift+End2 |
Erase Input |
Alt+End2 |
Fast Cursor Down |
Alt+V or Alt+2 (on the number keypad)) |
Fast Cursor Up |
Alt+^ or Alt+8 (on the number keypad) |
Field Mark |
Shift+Home2 |
Graphic Cursor |
Alt+F12 |
Highlighting Field Inherit |
Alt+3 (on the number keypad) |
Highlighting Reverse |
Alt+* (on the number keypad) |
Highlighting Underscore |
Alt+6 (on the number keypad) |
Home |
Home or 7 (on the number keypad) |
Insert |
Insert or 0 (on the number keypad) |
Jump Next |
Alt+PageUp |
Mark Down |
Shift+V |
Mark Left |
Shift+- |
Mark Right |
Shift+- |
Mark Up |
Shift+^ |
Move Mark Down |
Ctrl+V or Ctrl+2 (on the number keypad) |
Move Mark Left |
Ctrl+- or Ctrl+4 |
Move Mark Right |
Ctrl+-> or Ctrl+6 |
Move Mark Up |
Ctrl+^ or Ctrl+8 |
PA1 |
Alt+Insert2 |
PA2 |
Alt+Home2 |
PA3 |
Shift+PageUp2 |
Pause |
Ctrl+F7 |
PF1 to PF12 |
F1 to F12 |
PF13 to PF24 |
Shift+F1 to F12 |
Play |
Ctrl+F6 |
PS Field Inherit |
Ctrl+Shift+0 (on the number keypad) |
Print (Local Copy) |
Not assigned |
Quit (Device Cancel) |
Alt+Left Ctrl |
Record |
Ctrl+F5 |
Reset/Control |
Left Ctrl |
Response Time Monitor |
Ctrl+F11 |
Rule |
Ctrl+Home |
Sys Request |
Shift+Esc |
Tab Field |
>| or Shift+>| (on the number keypad) |
Tab Word |
Alt+> |
Test |
Ctrl+PageDown |
Transparency Field Inherit |
Ctrl+Shift+8 (on the number keypad) |
Transparency Opaque |
Ctrl+Shift+/ (on the number keypad) |
Word Wrap Toggle |
Alt+F2 |
Sample 1 - This sample step sends the following text "This is the text to send" to terminal session "MyTermSess." It is set to wait before and after the default prompt appears.
<AMSENDTERMTEXT SESSION="MyTermSess" WAITFORDEFAULTPROMPT="BOTH">This is the text to send. </AMSENDTERMTEXT>
Sample 2 - A sample task that uses all available terminal actions. Examining the step parameters and properties of this task may assist you in creating your own terminal emulation task.
<AMVARIABLE NAME="thePassword">password</AMVARIABLE> <AMCONNECTTERM EMULATION="VT220" HOST="linux.networkautomation.com" SHOWTERMINALWINDOW="YES" /> <AMWAITFORTERMTEXT TYPE="TEXT">login:</AMWAITFORTERMTEXT> <AMSENDTERMTEXT>%theUsername%{ENTER}</AMSENDTERMTEXT> <AMSHOWDIALOG>OK to proceed?</AMSHOWDIALOG>; <AMWAITFORTERMTEXT TYPE="TEXT">Password:</AMWAITFORTERMTEXT> <AMSENDTERMTEXT>%thePassword%{ENTER}</AMSENDTERMTEXT> <AMSHOWDIALOG>OK to proceed?</AMSHOWDIALOG> <AMDISCONNECTTERM />