View Single Post
  #3  
Old 03-20-2012, 11:41 AM
mikit mikit is offline
Registered User
 
Join Date: Mar 2012
Posts: 38
Hi Mike,

thank you very much for response.

First:
Explanation why I have a sequence of #, >>>, # there:
Problem is, that the script is logging to different devices with different "welcome screen". E.g. some of them have no banner and when you log in all you will get is devicename#, but some of them have banner which have "#" in it and that is causing a problem with a line where script is trying to read a hostname. That's why I put that sequence there #, >>>, #, because when first # occurs in a banner then there is a set of > (>>>) and then devicename# and with this I do not have problem with capturing of the hostname. I put a timeout there for devices that do not have this sequence, so basically first two (#, >>>) will timeout and then script will continue as it should with other commands.

Second:
Anyway, I have figured it out. I've just used simple

index = crt.Screen.WaitForStrings("SSCODE", "invalid", "ssword")
If index = 1 Then
"rest of the script"
ElseIf index = 2 Then
crt.Session.Disconnect
ElseIf index = 3 Then
crt.Session.Disconnect
End If

so if the expected string after username is not SSCODE, script will disconnect from the device and move to another device. This has fixed that issue with log file.

Maybe one more question. 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?
Reply With Quote