View Single Post
Old 03-20-2012, 11:47 AM
miked's Avatar
miked miked is offline
Registered User
Join Date: Feb 2004
Posts: 2,040
Is there any way how not to put all other strings (invalid, ssword, etc...) to index but something that will say, if there is anything else than SSCODE then disconnect from the device?
If you have a reasonably finite set of strings that would indicate failure then you could simplify the code to something like this:
index = crt.Screen.WaitForStrings("SSCODE", "invalid", "ssword", "Any", "other", "strings", "that", "indicate", "failure")
If index = 1 Then
    "rest of the script"
End If
In this case, it sounds like "SSCODE" is the only string that really matters. If you have an unreasonable number of possible strings to indicate failure and not good way to limit this, or you have only one string that matters, you could use WaitForString with a timeout.
Maybe you want to timeout after 20 seconds:
WaitForString("SSCODE", 20)
If crt.screen.WaitForString("SSCODE", 20) <> True Then
    ' Timed out waiting for SSCODE, assume the worst, disconnect
    ' We found SSCODE, carry on...
    "rest of the script"
End If
Do either of these ideas help?
VanDyke Software
Technical Support
Reply With Quote