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 02-09-2018, 08:16 AM
JacobUS JacobUS is offline
Registered User
 
Join Date: Feb 2018
Posts: 2
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
Reply With Quote
  #2  
Old 02-09-2018, 08:29 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
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
For your use it may look something like:

Code:
vlanID = crt.Dialog.Prompt("Enter VLAN ID:", "VLAN ID")
crt.Screen.Send "vlan create vlan " & vlanID & chr(13)
Does this help get you the behavior you're looking for?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 02-09-2018, 08:38 AM
JacobUS JacobUS is offline
Registered User
 
Join Date: Feb 2018
Posts: 2
That is exactly what I needed! Thanks for taking the time.
Reply With Quote
  #4  
Old 02-09-2018, 08:58 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
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
Reply With Quote
  #5  
Old 02-15-2018, 01:49 PM
bstedh bstedh is offline
Registered User
 
Join Date: Jan 2018
Posts: 41
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)
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 03:35 AM.