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 06-15-2018, 06:11 PM
Setchie Setchie is offline
Registered User
 
Join Date: Jun 2018
Posts: 2
Hide Command input

Hi all

I have made a script to run a series of commands however I only want one line of output to show in CRT ("show ap database | include ") while hiding output from all other commands:

#$language = "VBScript"
#$interface = "1.0"

Sub main

crt.Screen.Synchronous = false


b=crt.Dialog.Prompt("AP Hostname")


Username="Me"
Password="abc"
Hostname="router 1"


crt.Screen.Send "telnet 10.113.63.21" & chr(13)
crt.Screen.WaitForString "User:"
crt.Screen.Send Username & chr(13)
crt.Screen.WaitForString "Password:"
crt.Screen.Send Password & chr(13)
crt.Screen.WaitForString "(Hostname) >"
crt.Screen.Send "Enable" & chr(13)
crt.Screen.WaitForString "Password:"
crt.Screen.Send "ASD" & chr(13)
crt.Screen.WaitForString "(Router 1) #"
crt.Screen.Send "show ap database | include " & b & chr(13)
crt.Screen.WaitForString "(Router 1) #"
crt.Screen.Send "exit" & chr(13)
crt.Screen.WaitForString "(Router 1) >"
crt.Screen.Send "exit" & chr(13)


crt.Screen.Synchronous = false
End Sub

Thanks in advance
Reply With Quote
  #2  
Old 06-17-2018, 08:59 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 546
Hi Setchie,

The ability to selectively display the contents of the screen is not inherently built into SecureCRT. With a better understanding of the problem you're trying to solve I may be able to find solutions that help get you the behavior you're looking for.

Can you tell me a little more about why you would you would like to hide the output of other commands? What problem would this help you solve?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 06-17-2018, 02:49 PM
Setchie Setchie is offline
Registered User
 
Join Date: Jun 2018
Posts: 2
Thanks for the reply Eric

Basically the script checks through about 6 devices to check where an AP is authenticated too.

I want to hide the unnecessary output so that instead of having to look through about 50 lines of output it can be more clearly displayed in 6 lines making it easier to tell what device it is authenticated with.

Thanks
Reply With Quote
  #4  
Old 06-18-2018, 10:22 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 546
Hi Setchie,

One option that comes to mind is to capture that results of the ("show ap database | include ") command then display it to your screen. I envision it looking something like:
  1. Send the ("show ap database | include ") command
  2. Capture the results of the command to a variable
  3. Clear the screen
  4. Send the captured data to the screen only

This should allow you to only display the data you would like. I've put together a bit of example code.

Code:
strHostname = crt.Dialog.Prompt("AP Hostname")


crt.Screen.Send "show ap database | include " & strHostname & chr(13)
crt.Screen.WaitForString "show ap database | include " & strHostname & chr(13)

strCommandCapture = crt.Screen.ReadString("(Router 1) #")

crt.Screen.Clear
crt.Screen.Send strCommandCapture, true
crt.Screen.Send vbcr
Does this help get you the functionality you're looking for?
__________________
Thanks,
--Eric

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 08:40 AM.