📄 ttpmacro.txt
字号:
Format:
connect <command line parameters>
If TTPMACRO is not linked to Tera Term, this command runs Tera Term
with <command line parameters>, and links it to TTPMACRO.
If TTPMACRO has already been linked to Tera Term and Tera Term is
not connected to the host, this command causes Tera Term to connect
to the host specified by <command line parameters>.
If TTPMACRO has already been linked to Tera Term and Tera Term has
already been connected to the host, this command is ignored.
No other communication commands should be executed before the link is
established.
See Tera Term help for the format of <command line parameters>.
See also:
"4.1.4 closett"
"4.1.6 disconnect"
"4.1.29 unlink"
Example:
connect '' No command line parameter
connect '/C=2' Run Tera Term with parameter '/C=2'.
connect 'foohost.foo.foo.jp'
CommandLine = '111.111.11.11'
connect CommandLine
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.6 disconnect ** new **
Format:
disconnect
Closes the communication between Tera Term and the host.
If Tera Term is not terminated by this command, the link between Tera Term
and TTPMACRO is kept.
See also:
"4.1.4 closett"
"4.1.5 connect"
"4.1.29 unlink"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.7 flushrecv ** new **
Format:
flushrecv
Clears received characters in the buffer of TTPMACRO.
Characters received from the host are transfered to TTPMACRO.
TTPMACRO stores the characters in the buffer and character-reading
commands, such as the "wait" command, read out them from the buffer.
Characters in the buffer are kept until character-reading
commands process them or the buffer overflows.
The "flushrecv" command can be used to avoid unexpected results of
character-reading commands caused by old characters in the buffer.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.8 gettitle ** new **
Format:
gettitle <strvar>
Retrieves the title text of Tera Term and stores it in the string
variable <strvar>.
Example:
gettitle titletext
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.9 kmtrecv
Format:
kmtrecv
Causes Tera Term to receive a file from the host with the Kermit protocol.
Pauses until the end of the file transfer.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.10 kmtsend
Format:
kmtsend <filename>
Causes Tera Term to send the file <filename> to the host with the Kermit
protocol. Pauses until the end of the file transfer.
Example:
kmtsend 'readme.txt'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.11 loadkeymap ** new **
Format:
loadkeymap <filename>
Causes Tera Term to load a keyboard setup file specified by <filename>.
Example:
loadkeymap 'keyboard.cnf'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.12 logclose
Format:
logclose
Causes Tera Term to close the log file.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.13 logopen
Format:
logopen <filename> <binary flag> <append flag>
Causes Tera Term to start logging. Received characters are written to the file
<filename>.
If <binary flag> is zero, received new-line characters are converted (CR ->
CR/CRLF) and escape sequences are stripped out. If <binary flag> is non-zero,
received characters are written without any modifications.
If <append flag> is non-zero and the file <filename> already exists, received
characters are appended to it. If <append flag> is zero and the file <filename>
already exists, the file is overwritten.
Example:
logopen 'myhost.log' 0 0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.14 logpause
Format:
logpause
Causes Tera Term to pause logging. Received characters are discarded while
logging is paused.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.15 logstart
Format:
logstart
Causes Tera Term to restart the logging, if paused.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.16 logwrite
Format:
logwrite <string>
Appends a <string> to the log file of the Tera Term.
This command is valid only while Tera Term is logging. The <string> can be
written even while logging is paused.
Example:
logwrite 'LOG FILE'#13#10
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.17 quickvanrecv
Format:
quickvanrecv
Causes Tera Term to receive a file from the host with the Quick-VAN protocol.
Pauses until the end of the file transfer.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.18 quickvansend
Format:
quickvansend <filename>
Causes Tera Term to send the file <filename> to the host with the Quick-VAN
protocol. Pauses until the end of the file transfer.
Example:
quickvansend 'readme.txt'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.19 recvln ** new **
Format:
recvln
Retrieves a line of received characters from the host and stores it in
the system variable "inputstr".
This command waits until a line is received or the communication
between Tera Term and the host is terminated or the timeout occurs.
If the system variable "timeout" is greater than zero, the timeout occurs
when <timeout> seconds have passed. If the "timeout" is less than or equal
to zero, the timeout never occurs.
If the line is received successfully, the system variable "result"
is set to 1. Otherwise, "result" is set to zero.
Example:
fileopen file 'log.txt' 0 open the log file
setsync 1 enter synchronous mode
result=1
while result=1
recvln receive one line
filewriteln file inputstr write it to the log file
endwhile
setsync 0 enter asynchronous mode
See also "4.1.26 setsync" for the synchronous mode.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.20 restoresetup ** new **
Format:
restoresetup <filename>
Causes Tera Term to load a Tera Term setup file specified by <filename>.
Example:
restoresetup 'teraterm.ini'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.21 send
Format:
send <data1> <data2> ....
Causes Tera Term to send characters to the host.
If <data> is a string, the string is sent to the host. If <data> is an
integer, its lowest-order byte (0-255) is regarded as an ASCII code of the
character, and the character is sent to the host.
Example:
send 'ABC'
send 65 66 67 Send 'ABC'.
(ASCII code of the character "A" is 65.)
myname='Tera Term'
send 'My name is ' myname '.'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.22 sendbreak ** new **
Format:
sendbreak
Causes Tera Term to send a break signal to the host.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.23 sendfile
Format:
sendfile <filename> <binary flag>
Causes Tera Term to send the file <filename> to the host. Pauses until the end
of the file transfer.
If <binary flag> is non-zero, the file is sent without any modifications.
If <binary flag> is zero, new-line characters are converted (CR -> CR/CRLF)
and control characters except TAB, LF and CR are stripped out.
Example:
sendfile 'data.dat' 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.24 sendln
Format:
sendln <data1> <data2> ....
Causes Tera Term to send characters followed by a new-line character to the
host.
Format of <data> is the same as the "send" command (4.1.21).
Example:
sendln Only a new-line character is sent.
sendln 'abc'
Password='mypassword'
sendln Password
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.25 setecho ** new **
Format:
setecho <echo flag>
Changes the local echo status of Tera Term.
If <echo flag> is non-zero, the local echo is turned on.
If <echo flag> is zero, the local echo is turned off.
Example:
setecho 1 local echo on
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.26 setsync ** new **
Format:
setsync <sync flag>
Enters the synchronous communication mode if <sync flag> is non-zero,
or enters the asynchronous communication mode if <sync flag> is zero.
Tera Term transfers received characters from the host to TTPMACRO.
TTPMACRO stores the characters in the buffer. The character-reading commands,
such as the "wait" command, read out the characters from the buffer.
Initially, TTPMACRO is in the asynchronous mode. In this mode, the buffer may
overflow if no character-reading command is executed for a long time, or the
receiving speed is too fast.
In the synchronous mode, the buffer never overflows. If the buffer becomes
full, Tera Term stops receiving characters from the host and stops transfering
them to TTPMACRO. When the buffer regains enough space, Tera Term restarts
receiving and transfering.
Enter the synchronous mode only when it is necessary and re-enter the
asynchronous mode when the synchronous operation is no longer needed.
For a macro operation which requires reliability, something like processing
lines of received characters without loss of data, you need to enter the
synchronous mode. However, the synchronous mode makes Tera Term slow in speed
of receiving characters and causes Tera Term freeze if no character-reading
command is executed for a long time. On the other hand, a simple macro
operation, such as auto login, works with almost no problem in the
asynchronous mode, because the buffer size is large engough (4096 bytes) and
all received characters are processed by character-reading commands before
the buffer overflows.
See also "4.1.7 flushrecv" for clearing the buffer.
Example:
setsync 1 enter the synchronous mode
setsync 0 enter the asynchromous mode
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.27 settitle ** new **
Format:
settitle <title>
Changes the title text of Tera Term to <title>.
Example:
settitle 'Tera Term'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.28 showtt ** changed **
Format:
showtt <show flag>
Minimizes Tera Term if <show flag> is zero.
Restores Tera Term if <show flag> is greater than zero.
Hides Tera Term if <show flag> is less than zero.
Example:
showtt 0 Minimize Tera Term.
showtt 1 Restore Tera Term.
showtt -1 Hide Tera Term.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.29 unlink ** new **
Format:
unlink
Terminates the link between the current Tera Term window and TTPMACRO.
TTPMACRO enters the unlinked state and can not controll the
Tera Term window any more.
In the unlinked state, the "connect" command can open a new Tera Term
window and link TTPMACRO to it.
See also:
"4.1.4 closett"
"4.1.5 connect"
"4.1.6 disconnect"
Example:
connect 'host1' open a Tera Term window and link TTPMACRO to it
unlink terminate the link
connect 'host2' open another Tera Term window and link TTPMACRO to it
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.30 wait
Format:
wait <string1> <string2> ...
Pauses until one of the character strings is received from the host,
or until the timeout occurs. Maximum number of the strings is 10.
If the system variable "timeout" is greater than zero, the timeout occurs
when <timeout> seconds have passed. If the "timeout" is less than or equal to
zero, the timeout never occurs.
The "wait" command returns one of the following values in the system variable
"result":
Value Meaning
-------------------------------------------------------
0 Timeout. No string has received.
1 <string1> has received.
2 <string2> has received.
. .
. .
. .
Example:
timeout = 30 The timeout limit is 30 sec.
wait 'OK' 'ERROR' Wait until 'OK' or 'ERROR' has
received.
if result=0 goto timeout If timeout occurs, go to ':timeout'.
if result=1 goto ok If 'OK' has received, go to ':ok'.
if result=2 goto error
wait #10'>' 'complete.'#13 Wait a line beginning with the ">" or
a line ending with the "complete.".
(ASCII code of LF is 10, and CR is 13.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.31 waitevent ** new **
Format:
waitevent <events>
Pauses until one of the events specified by <events> occurs.
<events> can be combination of the following event identifiers.
Event Event identifier
---------------------------------
timeout 1
unlink 2
disconnection 4
connection 8
The timeout event occurs when <timeout> seconds have passed.
<timeout> is the value of the system variable "timeout".
If <timeout> is less than or equal to zero, this event never occurs.
The unlink event occurs when Tera Term is closed.
The disconnection (connection) event occurs when the
communication between Tera Term and the host is closed (opend).
The "waitevent" command returns the identifier of the actual event
in the system variable "result".
Example:
waitevent 4 Wait the disconnection event
waitevent 2 or 8 Wait the unlink or connection events
if result=2 goto label1 The unlink event occured
if result=8 goto label2 The connection event occured
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4.1.32 waitln ** new **
Format:
waitln <string1> <string2> ...
Pauses until a line which contains one of the character strings is received
from the host, or until the timeout occurs. Maximum number of the strings
is 10.
If the system variable "timeout" is greater than zero, the timeout occurs
when <timeout> seconds have passed. If the "timeout" is less than or equal to
zero, the timeout never occurs.
The "waitln" command returns the received line in the system variable
"inputstr" and one of the following values in the system variable "result":
Value Meaning
-------------------------------------------------------
0 Timeout.
1 A line which contains <string1> has received.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -