View Single Post
  #2  
Old 06-02-2020, 09:26 AM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 23
Quote:
Originally Posted by js11o9 View Post
I have a problem with above script
waitforstring does not work until the command "show tech | no"
so next command "show env | no " does not work too
WaitForString is working exactly as it's supposed to in this scenario.

One important thing to note with regards to crt.Screen.Synchronous = True is that you must keep the crt.Screen.WaitForString statements consistent with the number of times that crt.Screen.Send is called.

With your script, the first crt.Screen.WaitForString refers back to the "show run | grep hostname" command instead of the "Show clock" command that the first WaitForString is intended to focus on. The end result is that your existing script code has 3 Screen.Send statements before the first WaitForString call is made.

In general, the best practice for fixing such issues is to call crt.Screen.WaitForString after EVERY crt.Screen.Send.

Additional synchronization can be achieved by waiting for each command itself in addition to its corresponding shell prompt. For example:

Code:
strcmd = "Show clock"
crt.Screen.Send strCmd & vbcr
crt.Screen.WaitForString strCmd
crt.Screen.WaitForString strShellPrompt
__________________
Thanks,
--Cameron

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