# wait

Waits string.

    wait <string1> [<string2> ...]

## 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.

When the empty string is specified, this command will wait an character.

If the system variable "timeout" or "mtimeout" is greater than zero, the timeout occurs when <timeout>.<mtimeout> seconds have passed. If the timeout is less than or equal to zero, the timeout never occurs.

These commands return 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.
n | <stringn> has received. n=1..10.

## Example

    ; 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

## See also

- setdebug
- waitln
- waitregex