Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 09-24-2015, 02:37 PM
zzztazmanzzz zzztazmanzzz is offline
Registered User
 
Join Date: May 2015
Posts: 16
Is there a way to assign .key map to a session

I have my keys all mapped out and if I choose a connection from my connect tab\file I have no problems the .key map is assigned. How ever I have a script that is generated from a button and opens a new tab with a prompt for a remote connection - I am able to connect to the new connection via the script but I have to go in every time and load the .key so my key combinations work.

Is there a way in the script to assign a .key config
Reply With Quote
  #2  
Old 09-24-2015, 03:08 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi zzztazmanzzz,

The Default Session is where ad hoc connections derive their settings.

you can modify the Default Session in the General / Default Session category of the Global Options dialog.

If you configure your Default Session to use the key map file, do you get the behavior you want?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #3  
Old 09-24-2015, 04:33 PM
zzztazmanzzz zzztazmanzzz is offline
Registered User
 
Join Date: May 2015
Posts: 16
Is there a way to assign .key map to a session

yes if I go in there and do custom and browse to my .key file then it works

Same as if I go to the key editor and choose load file

What I would like is if the is applied within the script to use a specific .key map so I don't have to load the .key or update the default options every time
Reply With Quote
  #4  
Old 09-24-2015, 04:47 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi zzztazmanzzz,

Thanks for the update.

What version of SecureCRT are you using?

I would like to know more about your goal.

Do you need a specific key map file for specific types of devices?

How many key map files have you created?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #5  
Old 09-24-2015, 06:07 PM
zzztazmanzzz zzztazmanzzz is offline
Registered User
 
Join Date: May 2015
Posts: 16
Is there a way to assign .key map to a session

version 7.0.1 build 374

So just to be clear on my question - I have 100 connection setup in my connect option and all of those have the default key and all are working fine.

I have a button in a button bar that I use as a hot key to access devices on the fly. I created a script that comes up and asks me for the ip I want to connect to. I drop it in the box - it opens a new tab and takes me to that device. This is when I have to load the .key file as for some reason it bypassed the default setups. When I look at the properties of the new tab there is no checkmark in the "select an alternate keyboard emulation"
Reply With Quote
  #6  
Old 09-25-2015, 03:17 PM
zzztazmanzzz zzztazmanzzz is offline
Registered User
 
Join Date: May 2015
Posts: 16
Is there a way to assign .key map to a session

let me know if you would like to see my button script
Reply With Quote
  #7  
Old 09-25-2015, 04:53 PM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi zzztazmanzzz,

I would like to see your button script.

Please make sure that you don't have any sensitive data in the script before posting it.

Also, how many different key map files do you have?
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730
Reply With Quote
  #8  
Old 09-25-2015, 05:27 PM
zzztazmanzzz zzztazmanzzz is offline
Registered User
 
Join Date: May 2015
Posts: 16
Is there a way to assign .key map to a session

I only have one
Reply With Quote
  #9  
Old 09-25-2015, 05:30 PM
zzztazmanzzz zzztazmanzzz is offline
Registered User
 
Join Date: May 2015
Posts: 16
Is there a way to assign .key map to a session

strHost = ""
strUser = "user"
strPwd = "password"


Sub Main()

If strHost = "" Then
strHost = Trim( _
crt.Dialog.Prompt( _
"Specify host name or IP address", _
"Connect To Host", _
"192.168.0.1"))
' Bail if the input was cancelled
If strHost = "" Then Exit Sub
End If



' Connect in a new tab to the host specified
bWaitForAuthToCompleteBeforeReturning = False
bLetCallerDetectAndHandleConnectionErrors = True
Set objNewTab = crt.Session.ConnectInTab( _
"/Telnet " & strHost, _
bWaitForAuthToCompleteBeforeReturning, _
bLetCallerDetectAndHandleConnectionErrors)

If objNewTab.Session.Connected <> True Then
crt.Dialog.MessageBox "Failed to connect to " & strHost
objNewTab.Close
Exit Sub
End If

' Make sure the new tab is "Synchronous" so we can properly wait/send/etc.
objNewTab.Screen.Synchronous = True

' Handle authentication in the new tab using the new tab's object reference
' instead of 'crt'
nAuthTimeout = 10 ' seconds
Do
objNewTab.Screen.WaitForStrings _
"name:", _
"sword:", _
"invalid", _
"Bad", _
"fail", _
">", _
nAuthTimeout
Select Case objNewTab.Screen.MatchIndex
Case 0
crt.Dialog.MessageBox "Authentication timed out!"
Exit Sub

Case 1 ' "ogin:", "name:"
' Send the username
objNewTab.Screen.Send strUser & vbcr

Case 2 ' "sword:"
' Send the password
objNewTab.Screen.Send strPwd & vbcr

Case 3,4,5 ' "Login incorrect", "Please verify that the username..."
' Let user know, and attempt to get correct user/pass



' Automatically loop through to the top and try again...
strUser = "user"

Case 6 ' ">" <-- Shell prompt means successful login
exit do


'Case Else
'crt.Dialog.MessageBox "Ooops! Forgot to add code to handle " & _
' "this index: " & objNewTab.MatchIndex

End Select


Loop
strPwd = "password2"
objNewTab.Screen.Send "enable" & chr(13)
objNewTab.Screen.Send strPwd & vbcr

End Sub
Reply With Quote
  #10  
Old 09-28-2015, 10:31 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,306
Hi zzztazmanzzz,

Based on the conversation we have had, it sounds like you have a single key map file. If you configure your Default Session to use the key map file, the setting is not retained.

Is this correct?

There could be various reasons behind the problem with the Default Session not retaining the setting change. All of the scenarios I can imagine our outside of the control of SecureCRT.

Here is some example code to make the change to the Default Session for the key map file:
Code:
Set objConfig = crt.OpenSessionConfiguration
objConfig.SetOption "Keymap Name", "Custom"
objConfig.SetOption "Keymap Filename V2", "C:\Temp\Custom.Key"
objConfig.Save
You would add this code prior to establishing the connection to the device.

Does this help you accomplish your goal?
__________________
--Todd

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

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 AM.