View Single Post
  #3  
Old 10-12-2019, 12:37 AM
seesea's Avatar
seesea seesea is offline
Registered User
 
Join Date: Jun 2010
Posts: 20
Hi Allen,
Thank you for your reply, I can't test this in the latest version because we are not allowed to install that in our office's pc.
Since the help file is match the version, I think the script in the help should work on this SecureCRT, and I tested the SetOption in vbs, python and js, I found out that js not work only, but it is sure that js script can get the option object, what a pity I don't know how to operate it.
Is that js is not recommended and is not supported well in CRT scripting? I prefer to use js because all of the scripts in our department are js, it is a big project to change.

Bellow is my test:
1. vbs works:
Code:
# $language = "VBScript"
# $interface = "1.0"

Set objTab = crt.GetScriptTab
Set objConfig = objTab.Session.Config
objConfig.SetOption "Keymap v3", Array("C	VK_C                	DISABLED")
strValue = Join(objConfig.GetOption("Keymap v3"), vbcrlf)
crt.Dialog.MessageBox strValue
2. python works:
Code:
# $language = "python"
# $interface = "1.0"

objTab = crt.GetScriptTab()
objConfig = objTab.Session.Config
arrNewValue = []
arrNewValue.append(" C	VK_C                	DISABLED")
objConfig.SetOption("Keymap v3", arrNewValue)
arrValue = objConfig.GetOption("Keymap v3")
strValue = ''.join(arrValue)
crt.Dialog.MessageBox(strValue)
3. js not works:
Code:
# $language = "JScript"
# $interface = "1.0"

objTab = crt.GetScriptTab();
objConfig = objTab.Session.Config;
// ar = ["C	VK_C                	DISABLED"];
ar = new Array("C	VK_C                	DISABLED");
objConfig.SetOption("Keymap v3", ar);
strValue = objConfig.GetOption("Keymap v3").join(", ");
crt.Dialog.messageBox(strValue);
The error message is:
Code:
---------------------------
SecureCRT
---------------------------
CRT Scripting Runtime error
Error: The specified value is not valid for 'Keymap v3'.

Last edited by seesea; 10-12-2019 at 12:41 AM.
Reply With Quote