You can prepare a text file with list of command lines and play the file via Token2Shell. The connected remote system will see the played file as command lines that were typed and sent by you. Token2Shell also supports a set of wait/send style script commands.

Script Commands

When you create a macro file, its content is interpreted by line. A text line ends with <CR><LF> control characters and Token2Shell removes heading and trailing white spaces.

For each line, if the line starts with a “#” character, Token2Shell tries interpret the line as a macro command and its arguments. If it fails, the line is sent as it is along with line-end characters. The line-end characters are determined from the current session states.

// sends "abc"
#send "abc"

If you wish Token2Shell to interpret the line starting with “#” as a normal character, use two “#” characters.

// sends "#send "abc"" and line-end characters
##send "abc"

Token2Shell supports the following commands:

  • #sendwait line_send_interval_in_milliseconds

    Sets the interval between sending each non-command line text. If line_send_interval_in_milliseconds is preceded with a minus(-) character, the sending is paused until there is no incoming data for line_send_interval_in_milliseconds.

    When a macro file is loaded, the sending interval is set to -300 milliseconds, i.e., the next line is sent when there is no incoming data for 300 milliseconds.

  • #wait wait_time_in_milliseconds

    Pauses the macro processing for wait_time_in_milliseconds.

    If wait_time_in_milliseconds is preceded with a minus(-) character, the processing is paused until there is no incoming data for wait_time_in_milliseconds.

    // Wait for 3 seconds.
    #wait 3000
    
    // Wait until there is no incoming data for 2 seconds.
    #wait -2000
    
  • #sendstring

    Sends “string” (without the quotation marks).
    Line-end characters are not automatically sent.

  • #waitforstring

    Monitors the incoming data stream and waits until the “string” appears.

Token2Shell Escape Sequences

You can use the following escape sequences to insert control or special characters in a “string“:

CTRLDECBINOCTHEXToken2Shell Escape Seq.
NUL^@ 0 000 000000000
SOH^A 1 000 000100101
STX^B 2 000 001000202
ETX^C 3 000 001100303
EOT^D 4 000 010000404
ENQ^E 5 000 010100505
ACK^F 6 000 011000606
BEL^G 7 000 011100707
BS ^H 8 000 100001008\b
HT ^I 9 000 100101109\t
LF ^J 10 000 10100120A\n
VT ^K 11 000 10110130B
FF ^L 12 000 11000140C
CR ^M 13 000 11010150D\r
SO ^N 14 000 11100160E
SI ^O 15 000 11110170F
DLE^P 16 001 000002010
DC1^Q 17 001 000102111
DC2^R 18 001 001002212
DC3^S 19 001 001102313
DC4^T 20 001 010002414
NAK^U 21 001 010102515
SYN^V 22 001 011002616
ETB^W 23 001 011102717
CAN^X 24 001 100003018
EM ^Y 25 001 100103119
SUB^Z 26 001 10100321A
ESC^[ 27 001 10110331B\e
FS ^\ 28 001 11000341C
GS ^] 29 001 11010351D
RS ^^ 30 001 11100361E
US ^_ 31 001 11110371F
\ 92 101 11001345C\\
DEL^? 127111 11111777F
\x{HEX}
{HEX} is interpreted as a HEX value of the character.
Ex.) \x09 denotes <Tab> control character.