VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Configuration Folder variable (https://forums.vandyke.com/showthread.php?t=7039)

armanrivard 01-31-2011 06:30 AM

Configuration Folder variable
 
I'm using a Logon script I setup in session options:
F:\VPN\SecureCRT\scripts\login.vbs

I would like to leverage the GLOBAL 'Configuration folder' info if I can:
$config_folder\VPN\SecureCRT\scripts\login.vbs


Is there I way?

rtb 01-31-2011 11:46 AM

Hi armanrivard,

Thanks for the question. In SecureCRT 6.6.1, you can accomplish your goal. It is important to note that you will need to use the correct syntax for environment variables. In Windows this is %variable%. You could set a Global or User environment variable with a name of "Config", and then you could access this variable by adding %Config% in the Configuration folder section of the General category of the Global Options Dialog.

Does this help you accomplish your goal?

armanrivard 01-31-2011 12:41 PM

Thsnk you for the reply. But rather than having users set ENV vars I am looking to leverage something that is already being set during installation.

In your Global Options dialog, the user is already setting the 'Configuration folder' to f:\VPN\mythings

Now in the sessions dialog I would like to use that setting to find the script files.

'Configuration folder'/myscripts/foo.vbs

I have lots of logon scripts and I dont want to give them full paths in the session dialog. It would be nice if I could use the Config folder data to find the scripts.


Quote:

Originally Posted by rtb
Hi armanrivard,

Thanks for the question. In SecureCRT 6.6.1, you can accomplish your goal. It is important to note that you will need to use the correct syntax for environment variables. In Windows this is %variable%. You could set a Global or User environment variable with a name of "Config", and then you could access this variable by adding %Config% in the Configuration folder section of the General category of the Global Options Dialog.

Does this help you accomplish your goal?


rtb 01-31-2011 01:28 PM

Hi armanrivard,

Thanks for the clarification of what you want. I have created a feature request in our SecureCRT development database to add the ability to use a "configuration folder" variable in the logon script path in SecureCRT. Should a future release of SecureCRT have this capability, we will post to this forum thread.

If you would like to be notified directly, please complete and submit the form at the following location:
Submit Feature Request
In the meantime, you should be able to accomplish this goal using an environment variable.

Are you trying to resolve a specific problem by requesting this capability?

armanrivard 01-31-2011 02:56 PM

Excellent. I will be watching for the feature. Until then I will add an env that does the same.

My original issue:

I setup all of the secureCRT scripts and connections on an external drive on my local machine. I currently have more than 50 connections. Each connection runs a login script. Each login script location is setup in the session/options area and points to my local disk: v:/VPN/secureCRT/scripts/london.vbs

Once I have all of my connections automated I give the folder to other secureCRT users.

They drop the folder on an appropriate local drive and set the global 'Configuration folder' to that drive. So far so good.

But when the script tries to run it doesn't find my path. It's not possible for me to emulate my config for every user. But I can maintain the same directory structure on each system. if the v: could be replaced by the 'Configuration folder' it would all just fall into place.

Thank you for your efforts!

rtb 01-31-2011 04:32 PM

Hi armanrivard,

You are welcome. Thanks for letting me know what the original issue was. Based on this information, I think that the feature request is the best method to accomplish your goal. I would use the environment variables for now, though, because I can't say that this feature will be implemented any time in the near future.

rtb 07-07-2011 05:25 PM

Hi All,

We have a new pre-release SecureCRT build that has the ability to use a variable to substitute the configuration folder location. If anyone would like to test this new build, please send a message to support@vandyke.com with a subject of Attn: Todd - Substitute configuration folder location.

bkraptor 07-05-2013 07:16 AM

Would it be possible to share the newly-implemented solution for this particular problem?

rtb 07-05-2013 07:36 AM

Hi bkraptor,

This feature is available in the current official release of SecureCRT which is 7.1.1 at this point in time. You can download the current official release of SecureCRT from the following location:
http://www.vandyke.com/download/securecrt/download.html

bkraptor 07-05-2013 08:03 AM

I can not see any change in the way you can configure the logon script path. Is there a variable that you can reference to substitute for the absolute SecureCRT path?

rtb 07-05-2013 08:11 AM

Hi bkraptor,

You can use the "%C" substitution variable in the path of the logon script. For example:
%C\Scripts\LogonScript.vbs
Does this help?

bkraptor 07-05-2013 08:14 AM

Yes, this works. Thank you.

rtb 07-05-2013 09:19 AM

You are welcome bkraptor. Thanks for the confirmation.

vysh 04-20-2016 02:13 PM

1 Attachment(s)
Quote:

Originally Posted by rtb (Post 39510)
Hi bkraptor,

You can use the "%C" substitution variable in the path of the logon script. For example:
%C\Scripts\LogonScript.vbs
Does this help?

Hm, apparently this is not working in SecureCRT 8.0 for me.

Here's what I get instead:

Am I doing something wrong? %C is for the configuration folder, right?

jdev 04-20-2016 03:21 PM

I've verified that this (%C as a substitution for Configuration folder) works for me in SecureCRT 8.0. I've tried 6 minus 3 ways from Sunday to get it to fail, all my failure attempts have been successes using %C as it's correctly substituted for the configuration folder for SecureCRT (as long as I'm using a version of SecureCRT 7.0 and newer).

I'm running on Windows 10, 64-bit.

What OS are you running on?


--Jake

vysh 04-21-2016 01:46 AM

1 Attachment(s)
Today I tried it on another computer and still had no luck.

Here's how the setup looks on my PC:

And yes, I am on Windows 10 64bit.

vysh 04-21-2016 06:26 AM

Quote:

Originally Posted by jdev (Post 45696)
I've verified that this (%C as a substitution for Configuration folder) works for me in SecureCRT 8.0. I've tried 6 minus 3 ways from Sunday to get it to fail, all my failure attempts have been successes using %C as it's correctly substituted for the configuration folder for SecureCRT (as long as I'm using a version of SecureCRT 7.0 and newer).

I'm running on Windows 10, 64-bit.

What OS are you running on?


--Jake

I can confirm that %C works as a substitute for configuration folder path in logon scripts, but it does not work for me in Mapped Keys (Run Script) or Buttons (Run Script).

jdev 04-21-2016 08:59 AM

Quote:

Originally Posted by vysh (Post 45701)
I can confirm that %C works as a substitute for configuration folder path in logon scripts, but it does not work for me in Mapped Keys (Run Script) or Buttons (Run Script).

The way you original posted made it seem that it wasn't working for you as a component of your login script, so I appreciate you providing clarification.

The context of this thread is specific to login script, not mapped keys or button bar definitions. %C is currently implemented as a substitution only for login scripts.

You're wanting %C as a substitution for configuration folder when you have a path specified and your action/function with either a mapped key or button bar definition is Run Script, right?

--Jake

vysh 04-21-2016 11:56 PM

Quote:

Originally Posted by jdev (Post 45704)
You're wanting %C as a substitution for configuration folder when you have a path specified and your action/function with either a mapped key or button bar definition is Run Script, right?

--Jake

Yes, that's correct.

jdev 04-22-2016 10:32 AM

Quote:

Originally Posted by vysh (Post 45708)
Yes, that's correct.

OK. I've created a feature request for you. We'll post to this thread if support for %C is made available for Run Script paths in mapped keys and button bar definitions. If you'd like to receive email notification directly, send email to support@vandyke.com with a subject of "ATTN: Forum #7039 - %C for MappedKeys & ButtonBar"

--Jake

plissje 04-26-2016 03:30 AM

Hi guys,
Quick question regarding this as well. Is it possible to somehow get this value for a login script as well?

plissje 04-26-2016 04:00 AM

Hi guys,
Is there a way to actually use this %C in a login script as well?
Talking about having it in the actual code, not the path.

jdev 04-26-2016 09:44 AM

Quote:

Originally Posted by plissje (Post 45730)
Is there a way to actually use this %C in a login script as well? Talking about having it in the actual code, not the path.

%C isn't something that automatically gets substituted in script code, and it wouldn't be something that would be handled in every script call you could possibly make.

However, you can obtain the path to your configuration folder if you're running SecureCRT on Windows like this:
Code:

Sub Main()
    strConfigPath = GetConfigPath
    crt.Dialog.MessageBox("Config path:" & vbcrlf & vbcrlf & strConfigPath)
End Sub

' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function GetConfigPath()
    Set objShell = CreateObject("WScript.Shell")
    On Error Resume Next
    strConfigPath = objShell.RegRead("HKCU\Software\VanDyke\SecureCRT\Config Path")
    strConfigPath = objShell.ExpandEnvironmentStrings(strConfigPath)
    On Error Goto 0
    If strConfigPath = "" Then
        Err.Raise -2147221504 + 1000, _
            "SecureCRT's configuration path not found in the registry.", _
            "Unable to locate SecureCRT's configuration folder in HKCU." & _
            vbcrlf & vbcrlf
        Exit Function
    End If

    GetConfigPath = strConfigPath
End Function

Is this what you're looking for?

--Jake

dkrupicka 01-09-2019 04:25 PM

+1 for me on this feature request.
 
Quote:

Originally Posted by jdev (Post 45711)
OK. I've created a feature request for you. We'll post to this thread if support for %C is made available for Run Script paths in mapped keys and button bar definitions. If you'd like to receive email notification directly, send email to support@vandyke.com with a subject of "ATTN: Forum #7039 - %C for MappedKeys & ButtonBar"

--Jake

+1 for me on this feature request. I use the button bar for a lot of my scripts. However, I run SecureCRT in portable mode as I move to and from different machines a lot. Thus, the path to my script files (and files I call within the scripts) change a lot. If I could put the %C into the button bar, it would make my life a lot easier.

bgagnon 11-07-2019 11:22 AM

Hi all,

A feature similar to what has been requested in this thread has been implemented in a pre-release build version of SecureCRT.

Since v7.2.x, SecureCRT has supported templated paths to aid in cross-platform situations, see this post.

That functionality previously did not extend to paths (even though they may be a well-known path, such as the Config path or a subfolder of it) configured in mapped buttons or keys. Now it does.

If interested in trying the pre-release, send an email to support@vandyke.com and include Feature Request - #7039 (or similar) in the subject line.

Since your download account is how we make pre-releases available, if you are not writing us from the email address associated with that account, please include that info in the body of the email.


All times are GMT -6. The time now is 02:59 PM.