Programming with Reflection

image\rwnprg32.gif WaitForStrings method

 

Syntax WhichString = object.WaitForStrings(StringsArray, [Timeout], [Options])

 

Description

Waits for any one of two or more strings to be received from the host. This method returns an error if you are not connected to the host.

While waiting from an external application (such as stand-alone Visual Basic), the ProcessDatacomm property should be set to False to prevent Reflection from reading and processing characters between calls to Reflection methods.

Note: This method uses an OLE automation type, SAFEARRAY, that is not supported by VBA. If you are using this method in a Visual Basic macro, you can use the following syntax to access this method:

Session.Parent.Application.WaitForStrings (StringsArray, [Timeout], [Options])

Arguments

StringsArray Argument Type: String array
Required
Specifies one or more strings for which to wait. Reflection considers case (the incidence of uppercase and lowercase letters) in testing incoming data for a matching string.

Timeout Argument Type: String
Optional
Specifies the amount of time to wait for one of the specified strings to be received. The string is specified in HH:MM:SS.hh format. If this argument is omitted or is empty (""), Reflection waits indefinitely if none of the strings is received.

Options Argument Type: Enumeration
Optional
Specifies additional, non-default behavior for the method. There are three options for this method:

 rcAllowKeystrokes

 Specifies that the user is allowed to enter keystrokes in the terminal window during the wait.

 rcNoDisplay

 Specifies that incoming datacomm characters should not be displayed in the terminal window.

 rcNoTranslation

 Specifies that the StringsArray parameter contains binary data. Binary data is matched exactly as it is received from the host without performing host-to-PC character set translation.

 You can combine two or more options using the addition operator (+). For example: rcAllowKeystrokes + rcNoDisplay.

Return

WhichString Return type: Integer
A number indicating which item in the StringsArray array was found. If the first item is found, 1 is returned; if the second item is found, 2 is returned; and so on. If none of the strings are received before the Timeout time expires, False (0) is returned. If no Timeout is specified, this method cannot return False.

 

image\jump.gif Example

image\jump.gif Keyword Index

image\popup.gif Related Topics

image\popup.gif Reflection products that use this command