#1
|
|||
|
|||
python sleep delay
I am having issues with my script not executing sleep as expected. It appears that my sleep function is being executed first and not within the loop. I am trying to get the command in the loop to run every X seconds.
Code:
count = 0 szCommand1 = "set cli pager off" szCommand2 = "show interface all" objTab.Screen.Send(szCommand1 + "\r\n") while (count < 9): objTab.Screen.Send(szCommand2 + "\r\n") #Wait for X milliseconds crt.Sleep(1000), count count = count + 1 Last edited by jdev; 06-06-2016 at 09:13 AM. |
#2
|
||||
|
||||
Before you call crt.Screen.Send(), is crt.Screen.Synchronous true, or false?
If crt.Screen.Synchronous is true, then nothing will appear on the screen until you call a crt.Screen.WaitFor*() or a crt.Screen.ReadString(). This means that it may *seem* like your sleep call isn't happening like you desire, only because text won't show up on the screen until the script actually completes. This is by design so that you can make a call to screen.WaitFor*() or screen.ReadString() and have a high degree of confidence that data will not have been received and displayed to the screen between lines of code as the script is executing. In SecureCRT scripting, you should practice these general "good things":
--Jake
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
#3
|
|||
|
|||
excellent!
Quote:
Thanks, it is set to Synchronous. I think I got it now. Thanks for the good info! |
![]() |
Tags |
python , sleep |
Thread Tools | |
Display Modes | Rate This Thread |
|
|