The if command has two different forms:
The first form evaluates the condition [an expression such as err0 # 0 or reg(1) = 3] as either true or false. If the condition is true, the specified command, which can be any Autolog command, is performed. If the condition is false, the specified command is not executed.
The second form determines whether the specified string of characters has been received from the remote system: If it has been received, the specified Autolog command is performed. In this syntax, the string is a series of characters you want to see whether the remote system has sent, enclosed in a pair of double quotes. For example "Enter Password:" or "NO NEW MAIL". You will probably find it useful to turn on the fold option when using this kind of if command.
You can use these symbols for comparing registers and numbers:
Here is a sample script file that uses if to determine if the remote modem has answered our dial command:
dial 555-1212 if err0 # 0 goto no'answer ; if dial didn't work, handle error goto answered ; otherwise proceed as usual no'answer: :<remote system doesn't answer or is busy.> finish :X answered: ; remote modem answered, proceed as usual...The if command can also check to see whether certain characters or responses have been received from the remote system. For example:
This command checks to see if the characters "Enter Password:" have been received, and sends "My Password" and a carriage return to the remote system if they have.
You will probably want to use the fold option to ignore case and parity when using this type of if command.
Notice that the if command looks to see if the specified string has already been received completely at the moment the if command executes. The if command does not wait for the response. Use the until command to wait for a response. Use if to see whether the complete response has already been entirely received.
The if command empties
Autolog's internal holding buffer up to and including
the specified string if it is found in the holding buffer.