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 04-10-2019, 08:40 PM
dsp00k dsp00k is offline
Registered User
 
Join Date: Apr 2019
Posts: 2
Menu options with a script.

Hello,

I would like to use a simple IF statement test to see if a particular menu option is enabled and toggle said option from off to on to vice versa.

For example: Keyword Highlighting is a wonderful thing, but it drastically slows down the output of a large "show run" in a Cisco switch or router. I would like to embed the test to see if it is currently turned on and if so, turn it off.

I am aware that I can create a Button to do this but I would prefer to have it in my script similar to the following:

if crt.Session.Logging = -1 then
crt.Session.Log False
end if


Thanks!
Reply With Quote
  #2  
Old 04-11-2019, 08:24 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,784
Hi dsp00k,

If you simply want the toggle, it's one-line:

Code:
crt.Screen.SendSpecial("MENU_TOGGLE_KEYWORD_HIGHLIGHTING")
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 04-16-2019, 07:39 PM
dsp00k dsp00k is offline
Registered User
 
Join Date: Apr 2019
Posts: 2
I'm looking for a way to check if it's already turned on or not. As in the above logging example.
Reply With Quote
  #4  
Old 04-17-2019, 07:46 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,784
Hi dsp00k,

Sorry, I guess I only read half the sentence.

The corresponding session INI entry is Keyword Set. When disabled, the value will be:

S:"Keyword Set"=<None> (with the angle brackets)

So, you could use SessionConfiguration object and the GetOption() method:
If variable = <None> then use SetOption() method to set it to the desired keyword list.
See SecureCRT Help topic Scripting / Script Objects Reference / SessionConfiguration Object.
__________________
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 11:17 AM.