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 09-28-2018, 07:42 AM
securecrt2007 securecrt2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 9
Question Why doesn't AUTOPRINT work with a Send string?

Hi Everyone,

I would like to create a automated script to print a fixed string on CLI. I work with Securecrt 6.1.4 on Cisco routers. I did a long research on Google on the Vbscript topics but no results so far.

Here's the following script that never sent the "TEST" output to the printer:

crt.Screen.SendSpecial ("MENU_PRINT_AUTO")
crt.Screen.Send "TEST"
crt.Screen.SendSpecial ("MENU_PRINT_EJECT_PAGE")

MENU_PRINT_AUTO and MENU_PRINT_EJECT_PAGE work well if the string contain a Cisco command (CLI) for example show version or show flash or any other. It definitively sends the "show" output to the printer. Here's below:

crt.Screen.SendSpecial ("MENU_PRINT_AUTO")
crt.Screen.Send "show version"
crt.Screen.SendSpecial ("MENU_PRINT_EJECT_PAGE")

I tried to use mapped keys (Send string function) but no success.

Please any help will be greatly appreciated!

Thank you in advance!

Good day!

Michael

Last edited by securecrt2007; 09-28-2018 at 08:02 AM. Reason: Changing the title
Reply With Quote
  #2  
Old 09-28-2018, 08:40 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,557
Hi securecrt2007,

Version 6.1.4 is quite old.

In the current version (8.5.1), your script worked for me with a minor edit or two.

Quote:
Here's the following script that never sent the "TEST" output to the printer:
First, to clarify, the Send() function sends the command/text to the remote. It was not until v7.2.x that we added an option for "Send to Screen Only":

Changes in SecureCRT 7.2 (Beta 1) -- October 8, 2013
(7.2.0.359)
----------------------------------------------------
New features:


  • The script function Screen.Send() can be used to send text to the screen only by using a new optional parameter.
So it has to be a command that results in output. Also, you are going to want to insert a WaitForString() so that you know the output has ended before you print.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 09-28-2018, 09:45 AM
securecrt2007 securecrt2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 9
Hi Brenda,

Thank you for taking the time to answer my post. I tried your advice but it did not work.

crt.Screen.SendSpecial ("MENU_PRINT_AUTO")
crt.Screen.Send "TEST"
crt.Screen.WaitForString "TEST"
crt.Screen.SendSpecial ("MENU_PRINT_EJECT_PAGE")

Did you try the code above and posted earlier ? So do you confirm that AUTOPRINT automatically send the output to the printer not the console/screen ?

Thanks, Brenda!!!

Michael
Reply With Quote
  #4  
Old 09-28-2018, 09:47 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,557
Michael,

I think you misunderstood my response.

Is TEST a command that results in output from the remote you are connected to?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 10-01-2018, 09:21 AM
securecrt2007 securecrt2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 9
Re

Hi Brenda,

Test is NOT an output command but a comment I am adding to the end of the output for documentation purposes.

As an example,

SCRIPT INITIATES AUTOPRINT

show version:

CCCCCCCCCCCCCCCCCCC

show configuration:

XXXXXXXXXXXXXXXXXXX

show flash:

BBBBBBBBBBBBBBBBBBB

END OF OUTPUT

TEST <---- My comment here is NOT PRINTED!

I hope this clarifies.

Thank you, Brenda
Reply With Quote
  #6  
Old 10-01-2018, 10:15 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,557
Hi Michael,

And it will not be printed as I have tried to explain.

The Send() function is not designed to send arbitrary text to the printer to be printed.

The Send() function sends commands to the remote you are connected to. Then, utilizing the MENU_* keymap functions you have included in your script, that *resulting output* can be sent to the printer.

Please re-read my initial post here. Specifically the part following where I quoted you.

Unless you are using v7.2 or later and can send "TEST" to the screen only, it won't get printed.

In other words, the line of code that results in TEST being printed for me (in SecureCRT 8.5.1) is:

crt.Screen.Send "TEST", bSendToScreenOnly
Version 6.1.4 does not have the bSendToScreenOnly option available. Does this help clarify?
__________________
Thanks,
--Brenda

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

Last edited by bgagnon; 10-01-2018 at 10:16 AM. Reason: added clarification of version
Reply With Quote
  #7  
Old 10-02-2018, 05:18 AM
securecrt2007 securecrt2007 is offline
Registered User
 
Join Date: Jul 2007
Posts: 9
re

Yes, it does this time.

Thank you very much, Brenda.
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:34 PM.