#1
|
|||
|
|||
Script Sequencing Executing
Hello
I would like to get the counter for some router, so I've got a script ro read the values, so question is how to instruct to scheduled every period of time. |
#2
|
|||
|
|||
It might depend on what time period you are talking about. I often use something like this for short time periods:
Code:
' ------------ Wait for the next period. ---------- ' Set Delay to the Minutes you want to wait ' Turn off synchronous so the session can be used while we wait. text.synchronous = false For Mins = Delay - 1 to 0 step -1 For Secs = 59 to 0 step -1 crt.sleep 1000 ' Show a count-down in the status bar crt.Session.SetStatusText("Waiting " & _ Mins & ":" & right("00" & Secs,2) & " Minutes") Next Next text.synchronous = True |
#3
|
|||
|
|||
Thanks for the repply.
my purpose is to send a show xxx into router console, read the data and after few seconds, do it for a while. |
#4
|
||||
|
||||
Quote:
How long do you want to wait?
__________________
Mike VanDyke Software Technical Support [http://www.vandyke.com/support] |
#5
|
|||
|
|||
' Turn off synchronous so the session....
Quote:
Thanks for any reply |
#6
|
|||
|
|||
Crt.Screen.Synchronous = True/False
Moreover to my first post. I am wanting to run several tabbed sessions each with a script which does as miked as described. That is repeat a certain command and record the output at a defined interval until I press any key to stop. (Let me know if anyone want me to post the script. This works for Cisco routers and records the output to s single time/date stamped log file)
My question is, might the Crt.Screen.Synchronous = True/False setting, as set for a tabbed session, affect other tabbed sessions running similar scripts? I may have 10 tabs each running the same or similar script. Put another way, does the screen object have an instance for each tab independant of all the other tabs? Many thanks for any comments. |
#7
|
||||
|
||||
Quote:
Code:
' Set Synchronous to True so that we don't miss any data crt.Screen.Synchronous = True With that in mind, I think the comment about turning off synchronous so that the session can be used while we wait means we're not using WaitForString for a while, we should shut off synchronous so that SecureCRT becomes more user friendly/fast for scrolling huge amounts of text, etc.. WesR could probably describe the intent of the comment better than I did, but your question provided an opporutunity to discuss synchronous from another angle than it's usually discussed so I wanted to hop in! ![]() Quote:
Code:
Dim ScriptTab Set ScriptTab = crt.GetScriptTab ScriptTab.screen.synchronous = TRUE
__________________
Mike VanDyke Software Technical Support [http://www.vandyke.com/support] |
#8
|
|||
|
|||
That bit of code was just copied from a script that I had running at the time. Often in my environment, I want a script to run periodically, but I often like to be able to access the session and check things between the wait periods.
Turning off synchronous simply allows me to enter commands in the session while the script is waiting for time to pass. I put the countdown in the status bar so I know when I need to stop using the session because the script is about to run. Hopefully this helps. |
![]() |
Tags |
scheduled script |
Thread Tools | |
Display Modes | Rate This Thread |
|
|