#1
|
|||
|
|||
New to VBScript but longtime SecureCRT user
Hi all, I have been using SecureCRT for years to telnet to my equipment in the field but I have been using ProComm to run my initial provisioning scripts before I deploy them. ProComm is not an option anymore so I need some assistance using VBScript. Basically I want to use a Textbox so I can enter a value and then have that value edit a certain place in a line. Ex...
crt.Screen.Send "vlan create vlan 6,100-126" & chr(13) changed to crt.Screen.Send "vlan create vlan 3,100-126" & chr(13) Also the values may change from device to device, IE a management IP. Any help would be appreciated. Thanks |
#2
|
|||
|
|||
Hi JacobUS,
It sounds like you could make use of the Prompt Method. Description Prompt a user to enter a string.Remarks The Prompt function displays a simple dialog that has message and an edit field for the user to enter a string. The message parameter is an informational string displayed in the prompt dialog. Optionally the title of the prompt dialog may be set by passing a title string. By default the edit field is empty, but the initial contents of the edit field may be set with the optional default string. Finally, if the text entered in the edit field is to be obscured as it is entered (such as when entering a password) then the Boolean isPassword field should be set to True. If the user clicks OK, Prompt returns the entered string; whereas, if the user clicks Cancel, Prompt returns an empty string.VBScript Syntax crt.Dialog.Prompt(message [, title [, default [, isPassword ]]]) Example Code:
Dim pass pass = crt.Dialog.Prompt("Enter your password:", "Logon Script", "", True) If pass = "" Then ' User clicked Cancel button Else ' User added data End If Code:
vlanID = crt.Dialog.Prompt("Enter VLAN ID:", "VLAN ID") crt.Screen.Send "vlan create vlan " & vlanID & chr(13)
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
That is exactly what I needed! Thanks for taking the time.
|
#4
|
|||
|
|||
Hi JacobUS,
I'm glad to hear that's what you needed. I wanted to let you know of a couple of resources that may help ease your transition. We've put together A Guide to Using VBScript in SecureCRT that may help you get started. Another very useful tool is SecureCRT's Help. It contains reference material for available Properties and Methods. I find the easiest way to get to the information is to choose Help Topics from the main Help drop down menu. In the Contents tab choose Scripting then Script Objects Reference.
__________________
Thanks, --Eric VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#5
|
|||
|
|||
One thing I have used for creating a device config script is to have the script create and excel file with fields for items that change between each device that the user can fill in. Once the fields are all filled in with that devices specific info the script reads it all into variables and then proceeds to configure all of the devices parameters. This is a lot nicer as you can fill it all out in one shot. You can make your own standard format for the excel or have the script create it each time.
__________________
Version 6.7.3 (build 292) |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|