wait
等待字符串.
wait <string1> [<string2> ...]
解释
暂停直到从主机接收到一个字符串,或者直到超时发生。 最大字符串数为10。
当指定空字符串时,此命令将等待一个字符。
如果系统变量“timeout”或“mtimeout”大于零,则当超过<timeout>、<mtimeout>秒时发生超时。 如果超时小于或等于零,则永远不会发生超时。
这些命令在系统变量“result”中返回以下值之一:
值 | 含义 |
---|---|
0 | 超时。没有收到任何字符串。 |
1 | <string1> has received. |
2 | <string2> has received. |
n | <stringn> has received. n=1..10. |
例子
; The timeout limit is 30 sec. timeout = 30 wait 'OK' 'ERROR' ; If timeout occurs, go to ":timeout". if result=0 goto timeout ; has received, go to ":error". If result=1 goto ok ; "ERROR" has received, go to ":error". If result=2 goto error ; Wait a line beginning with the ">" or a line ending with the "complete.". (ASCII code of LF is 10, and CR is 13.) wait #10'>' 'complete.'#13 ; The timeout limit is 100 msec. timeout = 0 mtimeout = 100 wait 'server response'
; Waits control codes with hex mode setdebug 2 wait '11 0D 11 0D' setdebug 0