#1
|
|||
|
|||
WaitForStrings matching on partial match
I have a script that is meant to run across multiple router OSes. However I am experiencing an issue where the WaitforStrings isn't behaving as expected.
It is currently set to wait for the following: vPossiblePrompts = Array(_ Router + "#",_ Router + "-re0>",_ Router + "-re1>",_ Router + "> (enable)") where 'Router' is the hostname. This hostname usually includes the model number of the device. When trying to match prompts on CatOS I am finding that the prompts are matching the following line: Hardware Version: 3.0 Model: WS-C6509 Serial #: XXXXXXX What I think is happening is the router name in this instance is formatted similar to "location-func01-6509" and for some reason only the last portion of the router name after the last dash is being matched and is somehow succeeding the WaitForStrings command. FYI, when troubleshooting (with synchronous on) the output stops before the serial number is displayed, which further raises my suspicions. Could this be the problem or do I need to investigate further? Version 7.2.3 (x64 build 500) |
#2
|
|||
|
|||
Hi umbongo,
What scripting language are you using? If you are using VBScript, then the string concatenator is "&" rather than "+". Does changing the string concatenator to "&" resolve the issue? If not, it may be helpful to see if your array of strings to wait for is what you think it should be. You can see what your array contains by adding the following line of code after you create your array: crt.Dialog.MessageBox Join(vPossiblePrompts, vbcrlf) |
#3
|
|||
|
|||
![]()
Hi Todd,
Thanks for your reply. Unfortunately changing from '+' to '&' didn't solve my problem. However your suggestion to throw a messagebox to show if the prompts match what I expect did, and I felt like a plum when I saw the output... The bottom line was I was setting the Possible prompts outside a loop where the Router variable changed each time. I moved that to within the loop and all my problems melted away. Thanks for reminding me how sanity should be employed at every point of testing! ![]() |
#4
|
|||
|
|||
Great news umbongo. Thanks for posting the update.
I feel that the power of strategically placed message boxes for debugging purposes can't be overstated. |
![]() |
Tags |
waitforstrings |
Thread Tools | |
Display Modes | Rate This Thread |
|
|