Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-08-2015, 06:33 AM
umbongo umbongo is offline
Registered User
 
Join Date: Oct 2015
Posts: 13
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)
Reply With Quote
  #2  
Old 12-08-2015, 09:59 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
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)
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 12-09-2015, 03:34 AM
umbongo umbongo is offline
Registered User
 
Join Date: Oct 2015
Posts: 13
Talking Problem solved

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!
Reply With Quote
  #4  
Old 12-09-2015, 08:42 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
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.
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
Reply

Tags
waitforstrings

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:41 PM.