until

The until command can be used when you want a script to wait for an expected response from the remote computer. You can use if to see whether an expected response has already been received from the remote computer. Use until to wait a specified amount of time for the response.

The until command has this format:
 

until "string" number of seconds

The string is the response or string of characters you're look for from the remote system, enclosed in a pair of double quotes, " ". The number of seconds is how long you want to wait for that response. For example:
 

until "Enter password: " 10

This command checks to see if the characters "Enter password: " have been received. If they haven't, Autolog will wait up to 10 seconds, checking frequently, until either the response has been received or the time has elapsed. If no match on your expected response is received in the specified amount of time, err0 will be set to 235 and you'll get a no match received error message.

Note The until command empties Autolog's internal holding buffer up to and including the specified string if it is found in the holding buffer.

You will probably want to use the fold option to ignore case and parity when using until.

Here's a sample script file that uses until to wait for sign-on prompts from the remote system:

fold true                    ; ignore case
dial 555-1212                ; dial remote system
if err0 # 0 goto no'connect  ; make sure remote has answered
say "^m"                     ; give carriage return
until "enter name:" 20       ; wait for prompt
if err0 # 0 goto no'response ; make sure we got prompt
say "my name^m"              ; enter name and carriage return
until "enter password:" 10   ; wait for prompt
if err0 # 0 goto no'response ; make sure we got prompt
say "my password^m"          ; enter password and carriage return
until "welcome" 10           ; wait for "welcome" message