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 03-10-2016, 09:46 PM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
Configuration Folder Path

Can you please supply me with the VBS syntax to return SecureCRT's 'Configuration Folder Path' (Options / Global Options / General / Configuration Paths)

Thanks..
Reply With Quote
  #2  
Old 03-11-2016, 08:28 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,291
Hi Casey,

Presently, there is only a method (a property actually) for returning the part of the session path *after* the Sessions subdirectory of the config folder (Scripting / Script Objects Reference Session Object / Path Property in SecureCRT's Help file).

SecureCRT's config path is stored in the registry. There is no scripting API to access configuration options in SecureCRT's Global Options dialog presently.

What are you trying to accomplish?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 03-11-2016, 12:20 PM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
I'm just working on a poor man's way to easily toggle the Keyword list on and off. Sometimes, I need things to scroll on my screen quickly and colorizing is less important.

Attached is the file I was toying with. Just set the script as a button on your toolbar and go nuts enabled/disabling the keyword highlighting with a single click.
Attached Files
File Type: zip KeywordToggle.zip (2.7 KB, 184 views)
Reply With Quote
  #4  
Old 03-11-2016, 01:56 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 990
How about something much more simple (don't write to the ini file... just use the session config object API directly):

Code:
' Toggle Keyword Highlighting (between "Example" or <None>)
' where "Example" is the name of the keyword set defined in
' Session Options, and is passed in as the first argument to
' this script.

Sub Main()
    If crt.Arguments.Count < 1 Then
        crt.Dialog.MessageBox(_ 
            "SecureCRT supports multiple keyword highlighting sets.  " & _
            vbcrlf & vbcrlf & _
            "Please provide the name of the highlight set you would " & _
            "like to toggle between as an argument to the script when " & _
            "creating the button definition.")
        Exit Sub
    End If
    
    ' Get the current keyword set:
    strSet = crt.session.config.GetOption("Keyword Set")
    
    ' Enable keyword highlighting with set passed if none is currently selected,
    ' or if a different keyword highlighting set is currently enabled.
    If strSet = "" Or strSet <> crt.Arguments(0) Then
        crt.Session.Config.SetOption "Keyword Set", crt.Arguments(0)
        
        ' Make sure color is turned on
        crt.Session.Config.SetOption "Highlight Color", True
    Else
        ' Toggle keyword highlighting set to none if set passed is already being
        ' used.
        crt.Session.Config.SetOption "Keyword Set", ""
    End If
    
End Sub
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #5  
Old 03-11-2016, 03:01 PM
Casey Casey is offline
Registered User
 
Join Date: Oct 2011
Posts: 114
Quote:
Originally Posted by jdev View Post
How about something much more simple (don't write to the ini file... just use the session config object API directly):
Me? Do something Simple? I think that would even make Brenda laugh.

But really, the reason I used the INI file was because I wanted a single button to be able to account for unlimited number of keyword files/sessions. The INI is just to keep track of what the old name was and not depend on arguments. Otherwise, to account for 3 different keyword files, you now have to have 3 different buttons with different arguments.

That's easier for me writing the script, but more work for the user using it.

I've had multiple keyword files for various sessions in the past (IE: one for VMware ESX, Cisco switch/route, Netscalers, etc).

It's far from a perfect solution..
Reply With Quote
  #6  
Old 03-11-2016, 04:32 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 990
Ah. Yes. If you have more than one color scheme best to keep it around somewhere.

I suppose you could throw it into the Description field so that the definition stays with the session.ini file itself... but I recall vaguely that you don't use saved sessions -- always ad hoc, so that idea doesn't help much.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
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 05:14 PM.