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 08-13-2009, 04:22 AM
samoki samoki is offline
Registered User
 
Join Date: Jun 2006
Posts: 24
How can I send space key for next page

Hi!I have a question:
Some router commands will give a very long output.Telnet session will output a page and when I press space key,it will go on to next page.I want to do this automatically,I use command
crt.screen.send chr(32)
or
crt.screen.send " "
,but it do not work both.
How can I solve it?
I use SecureCRT 5.1
Reply With Quote
  #2  
Old 08-13-2009, 10:03 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,635
Hello samoki,

You can accomplish sending a space to the remote using either of the methods below:
Code:
crt.screen.send chr(32) 
crt.screen.send " "
How does your script recognize when a page of output is complete?

What are your current results? (ie: script errors, waiting for input)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 08-13-2009, 06:41 PM
samoki samoki is offline
Registered User
 
Join Date: Jun 2006
Posts: 24
I use sentence:
Code:
"crt.screen.WaitForString(RouterID &"#",2)"
in a "Do Until...Loop" to judge.If not appear,script will use
Code:
crt.screen.send chr(32) 
or 
crt.screen.send " "
to make output going on.
What I mean is:
Script do not wait output break,if condition is not appear in 2 second,script will give a space to make output going on.

Last edited by samoki; 08-13-2009 at 06:51 PM.
Reply With Quote
  #4  
Old 08-14-2009, 08:39 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,635
Hi samoki,

Thank you for the clarification.

Let me know how it works.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 08-19-2009, 03:42 AM
samoki samoki is offline
Registered User
 
Join Date: Jun 2006
Posts: 24
Hi bgagnon,
In fact,it can not work well.
I use these codes:
Code:
Do Untile crt.screen.waitforstring("router#",5)
  crt.screen.send Chr(32)
Loop
but,when system appear '-- More --',it will appear 'router#' at same time,and the loop will end at that time.
I want know in 'vt100' mode,what break character will appear for program to recognize it's time to give a space character?
Thank you.
Reply With Quote
  #6  
Old 08-19-2009, 10:42 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,635
Hi samoki,

Does your script follow the example found in Chapter 4 of the scripting manual available from our website?

Specifically, the information found in:
Section 4.3: Using MatchIndex to Determine Which String ReadString() Detected

Setting crt.Screen.Synchronous = True is necessary to avoid missing data sent from the remote while other code within the script is being executed.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 08-19-2009, 12:28 PM
TroyC TroyC is offline
Registered User
 
Join Date: Aug 2009
Posts: 7
A different approach...

What about just setting the terminal length to zero [0] at the beginning of your script, and then setting it back to what ever it is the norm for your environment [we typically use 40, although on a few devices we have it set to 38].

seawa-bbm-rt1#terminal length ?
<0-512> Number of lines on screen (0 for no pausing)



Here's the typical first two lines of my scripts:::

crt.Screen.Send "!! Script starting... " & chr(13)
crt.Screen.Send "term len 0" & chr(13)

and my last two lines:::

crt.Screen.Send "term len 40" & chr(13)
crt.Screen.Send "!! Script completed fine " & chr(13)

hth,
TroyC
Reply With Quote
  #8  
Old 08-20-2009, 01:35 AM
samoki samoki is offline
Registered User
 
Join Date: Jun 2006
Posts: 24
Hi bgagnon & TroyC,
I have read the script document on your website,I will have more testing for it.
Thanks a lot!
Reply With Quote
  #9  
Old 04-11-2012, 07:25 AM
ozymandius100 ozymandius100 is offline
Registered User
 
Join Date: Feb 2012
Posts: 20
To resurrect a old thread. I am doing something with Python for this same type of thing, but i need to grab information on the screen as it passes. I tried to utilize the Get2 method, but the amount of data sometimes exceeds the pager length of the screen. I will be pulling different information from different pages, so looping this would be great.

I tried to have it wait for a --More-- and then hit spacebar, but it appears to ignore this information. Setting terminal le 0 is not a option, as this would always provide issues. Here was some sample code:

szCommand = "show ver"
objTab.Screen.Send(szCommand + "\r\n")
while True:
strScreenText = objTab.Screen.Get2(1,1,crt.Screen.Rows,crt.Screen.Columns)
if "--More--" in strScreenText:
objTab.Screen.Send(" ")
if 'Express 8.6.1' in strScreenText:
ExpressPresent = "True"
else :
ExpressPresent = "Fail"

if "Router#" in strScreenText:
break

crt.Dialog.MessageBox("ExpressPresent = " + ExpressPresent )
Main()


any suggestions?
Reply With Quote
  #10  
Old 04-11-2012, 08:25 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,635
Hello ozymandius100,

Although the scripting manual uses VBScript examples, the concept described in section 4.3 would still apply to the script you are writing in Python.

It would be better to use ReadString() and MatchIndex to determine the action to take based on the possibilities contained in the received output.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 04-11-2012, 08:45 AM
ozymandius100 ozymandius100 is offline
Registered User
 
Join Date: Feb 2012
Posts: 20
Quote:
Originally Posted by bgagnon View Post
Hello ozymandius100,

Although the scripting manual uses VBScript examples, the concept described in section 4.3 would still apply to the script you are writing in Python.

It would be better to use ReadString() and MatchIndex to determine the action to take based on the possibilities contained in the received output.
Thank you Brenda for your response. I will give it a shot.

Last edited by ozymandius100; 04-11-2012 at 08:59 AM.
Reply With Quote
  #12  
Old 04-11-2012, 10:09 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,635
Hi ozymandius100,

As a note, I have added this thread to a feature request in our product enhancement database for a Python scripting manual. Should such a manual be made available, notification will be posted here.

If you prefer direct e-mail notification, contact support@vandyke.com and include "Feature Request - Forum Thread #3769" in the subject line.
__________________
Thanks,
--Brenda

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


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 04:21 AM.