Example

This example waits 20 seconds for one of three prompts to be received from the host and transmits a different string (plus carriage return) depending upon which prompt is received.

Sub WhichPromptDemo()

 Dim myArray(1 To 3) As String

 myArray(1) = "Prompt 1:"

 myArray(2) = "Prompt 2:"

 myArray(3) = "Prompt 3:"

 Select Case Application.WaitForStrings(myArray, "20", rcAllowKeystrokes)

  Case 1:

   Session.Transmit "Text1" & Chr$(rcCR)

  Case 2:

   Session.Transmit "Text2" & Chr$(rcCR)

  Case 3:

   Session.Transmit "Text3" & Chr$(rcCR)

  Case Else

   MsgBox "Timed out with no recognized prompt."

 End Select

End Sub