Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-12-2012, 09:33 AM
jmendozaper jmendozaper is offline
Registered User
 
Join Date: Jun 2011
Posts: 2
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.
Reply With Quote
  #2  
Old 02-13-2012, 08:17 AM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
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
Reply With Quote
  #3  
Old 02-22-2012, 03:57 PM
jmendozaper jmendozaper is offline
Registered User
 
Join Date: Jun 2011
Posts: 2
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.
Reply With Quote
  #4  
Old 02-23-2012, 01:01 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Quote:
read the data and after few seconds, do it for a while
It sounds like you want to stay connected to the router, send a show xxx, read data, then wait for a little while before repeating the same steps (send show xxx, read, sleep). Is this correct?

How long do you want to wait?
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #5  
Old 04-10-2012, 05:00 PM
slouw slouw is offline
Registered User
 
Join Date: Nov 2005
Posts: 163
' Turn off synchronous so the session....

Quote:
' Turn off synchronous so the session can be used while we wait.
What exactly does this mean?
Thanks for any reply
Reply With Quote
  #6  
Old 04-10-2012, 05:11 PM
slouw slouw is offline
Registered User
 
Join Date: Nov 2005
Posts: 163
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.
Reply With Quote
  #7  
Old 04-10-2012, 06:10 PM
miked's Avatar
miked miked is offline
Registered User
 
Join Date: Feb 2004
Posts: 2,040
Quote:
Quote:
' Turn off synchronous so the session can be used while we wait.
What exactly does this mean?
SecureCRT may be a little slower when synchronous is true, because when crt.Screen.Synchronous = true data is not painted to the screen before WaitForString or related functions read the data. This has been discussed in some other threads, including this one. The SecureCRT Scripting Guide discusses crt.Screen.Synchronous, and in one spot shows the following:
Code:
' Set Synchronous to True so that we don't miss any data
crt.Screen.Synchronous = True
That again indicates we want SecureCRT to perhaps incur a speed hit so that WaitForString et. al. do not miss data.

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:
My question is, might the Crt.Screen.Synchronous = True/False setting, as set for a tabbed session, affect other tabbed sessions running similar scripts?
Setting synchronous only modifies the tab - you can have different synchronous states in different tabs.
Code:
Dim ScriptTab
Set ScriptTab = crt.GetScriptTab
ScriptTab.screen.synchronous = TRUE
__________________
Mike
VanDyke Software
Technical Support
[http://www.vandyke.com/support]
Reply With Quote
  #8  
Old 04-10-2012, 06:55 PM
WesR WesR is offline
Registered User
 
Join Date: Mar 2005
Location: USA
Posts: 149
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.
Reply With Quote
Reply

Tags
scheduled script


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 08:21 AM.