TTL脚本介绍及常用命令

tera term超级终端
一款Window上的虚拟终端工具,它同时支持串口连接和网络连接,而对于网络连接它支持Telnet和SSH协议。最关键的是Tera Term支持自己的脚本语言,即TTL(Tera Term Language)。该语言语法丰富而且简单易学,同时Tera Term 支持命令行操作,两者结合起来可以满足各种自动化方面的需求

支持TTL脚本语法:
分号‘;’表示注释,参数可用双引号和单引号,不区分大小写,不支持多窗口操作,如果采用前两种运行方式,需要关闭所有已经打开的TT主窗口, 否则会报连接错误
TTL脚本的命名一览和相关介绍请参考Tera Term的help文件。


TTL脚本是为tera term这个软件服务的。
tera term加载TTL脚本后,会自动运行脚本,然后执行脚本里的命令。

主要作用:使操作者,可以在windows下,操作简单的命令,就完成了程序的传输和安装。
即:将windows里的安装包通过tera term传到linux下,并安装。

https://www.xuebuyuan.com/579178.html
http://blog.sina.com.cn/s/blog_5d9051c00100fdyl.html

=================================================

Pause:(暂停)

pause


Sendln:(发送命令并换行)

sendln ....Remarks:Causes Tera Term to send characters followed by a new-line character to the host.     
     
Send:(发送命令)         
send ....Remarks:Causes Tera Term to send characters to the host.
If is a string, the string is sent to the host. 
If 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.
       例如:按Tab键的命令是send
#9          
wait:(等待匹配的字符串出现)        
wait [ ...]Remarks:Pauses until one of the character strings is received from the host, or until the timeout occurs. Maximum number of
the strings is 10.

     注:使用这个命令是需要设置timeout时间,命令的返回结果保存在resault变量中,

         当resault为0时,则为超时。Timeout设置命令如下:

          timeout=1 
/*等号后面的值为整数,设为负则是无限等待*/

    waitln:(等待整行匹配的字符串出现)        
waitln [ ...]Remarks: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,then,elseif,else,endif,goto等请参考help文件。


脚本作成的注意点
a.不同的ttl脚本内指定的Log文件名不能重复。
b.脚本的最后部分请清空测试环境,以便下一个ttl脚本执行。
c.在执行比较缓慢的地方,例如连接机器时,请追加pause命令
d.脚本尽量写得简洁短小,以便式样发生变更时易于更改。
e.必要的时候可以追加注释


====================================================================

TTL语言(TeraTerm Language)总共只有四种数据类型,分别为Integer、Character sting、Integer Array、String Array。

Integer:

带符号的32bit数据,不支持浮点数运算。

Character String:

一串不包含NULL的字符序列(最长511个字符)

Integer Array

整形数组,最大index(索引)为65536.常用intdim来声明。

intdim

eg: intdim sam 20   ;即声明了sam[0]~sam[19]共20个integer。

String Array

字符串数组,最大index(索引)为65536.常用strdim来声明。

strdim

eg: strdim sam 20   ;即声明了sam[0]~sam[19]共20个string。

 

参考:

https://blog.csdn.net/pfm685757/article/details/64503262

http://blog.sina.com.cn/s/blog_5d9051c00100fdyl.html

 

相关资料:

tera term 英文官网: http://www.teraterm.net/manual/en/

ttl 命令 手册: http://www.teraterm.net/manual/en/macro/command/index.html

你可能感兴趣的:(TTL脚本)