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 08-24-2016, 04:49 PM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
Variables in basic script

i have a basic script for backing up a config to my tftp but i want to make it better so it doesn't always send the file as the default running-config.

i would like to send a string of variables so the filename ends up being something like sessionname-hostname-date-time.cfg

any ideas?

here is my basic one

Sub Main
crt.Screen.Send "copy run tftp" & chr(13)
crt.Screen.WaitForString "Address or name of remote host []? "
crt.Screen.Send "1.1.1.1" & chr(13)
crt.Screen.WaitForString "]? "
crt.Screen.Send chr(13)
End Sub
Reply With Quote
  #2  
Old 08-24-2016, 05:40 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,021
In the Script Examples "sticky", there's an example script named Cisco Save Running/Startup Config to Local File that shows how this can be done (without a TFTP server being involved). This script saves the file as a name which follows this format:
SessionName_RemoteAddress_TYPE-config_YYYYmmdd_HHMMSS.ttt.txt
(Where Type is either 'running-config' or 'startup-config')

The example I've mentioned is written in python, but a similar approach could be done in VBScript.

Here's a VBScript function that you can use to get a unique basename for a file, based on the current datetime stamp(including milliseconds):
Code:
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Function GetUniqueFileName()
    ' Use WMI to get at the current time values
    Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
    For Each objItem In colItems
        strLocalDateTime = objItem.LocalDateTime
    Next
    ' strLocalDateTime has the following pattern: ' 20111013093717.418000-360
    ' That is: YYYYMMDDHHMMSS.MILLIS(zone); Take the left-most 18 digits...
    strFilename = Left(strLocalDateTime, 18)
  
    ' Return the unique filename as value of this function
    GetUniqueFileName = strFilename
End Function
And here's an example of how you can get the current session's name:
Code:
' Get the current session's path:
strSessionPath = crt.Session.Path

' Get the session's parent folder -- as displayed in the Connect dialog:
Set fso = CreateObject("Scripting.FileSystemObject")
strParentFolder = fso.GetParentFolderName(strSessionPath)
If strParentFolder = "" Then strParentFolder = "[\]"

' Get the current Session's name:
strSessionName = fso.GetFileName(strSessionPath)

'Display the information in a msg box:
crt.Dialog.MessageBox _
    "Here are the details about this session's name & path:" & vbcrlf & _
    String(60, "_") & vbcrlf & vbcrlf & _
    "Name: " & vbtab & chr(34) & strSessionName & chr(34) & vbcrlf & _
    String(60, "_") & vbcrlf & vbcrlf & _
    "Path: " & vbtab & chr(34) & strSessionPath & chr(34) & vbcrlf & _
    String(60, "_") & vbcrlf & vbcrlf & _
    "Parent folder: " & vbtab & chr(34) & strParentFolder & chr(34) & _
    vbcrlf & "(as displayed in Connect dialog)"

Here's how you can peel out the hostname, though this won't work for ad hoc connections -- for ad hoc connnections you can get at the remote IP address.
Code:
MsgBox crt.Session.Config.GetOption("Hostname")
MsgBox crt.Session.RemoteAddress

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #3  
Old 08-25-2016, 04:08 PM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
With the variable you show crt.Session.Config.GetOption("Hostname") it returns the hostname for the connection, how do you get the name of the session?
Reply With Quote
  #4  
Old 08-25-2016, 04:17 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,021
Quote:
Originally Posted by mike1572 View Post
With the variable you show crt.Session.Config.GetOption("Hostname") it returns the hostname for the connection, how do you get the name of the session?
That's explained in my earlier post... second code box?

Here it is again:
Quote:
Originally Posted by jdev View Post

And here's an example of how you can get the current session's name:

Code:
' Get the current session's path:
strSessionPath = crt.Session.Path

' Get the session's parent folder -- as displayed in the Connect dialog:
Set fso = CreateObject("Scripting.FileSystemObject")
strParentFolder = fso.GetParentFolderName(strSessionPath)
If strParentFolder = "" Then strParentFolder = "[\]"

' Get the current Session's name:
strSessionName = fso.GetFileName(strSessionPath)

'Display the information in a msg box:
crt.Dialog.MessageBox _
    "Here are the details about this session's name & path:" & vbcrlf & _
    String(60, "_") & vbcrlf & vbcrlf & _
    "Name: " & vbtab & chr(34) & strSessionName & chr(34) & vbcrlf & _
    String(60, "_") & vbcrlf & vbcrlf & _
    "Path: " & vbtab & chr(34) & strSessionPath & chr(34) & vbcrlf & _
    String(60, "_") & vbcrlf & vbcrlf & _
    "Parent folder: " & vbtab & chr(34) & strParentFolder & chr(34) & _
    vbcrlf & "(as displayed in Connect dialog)"
--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #5  
Old 08-25-2016, 04:22 PM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
i am extremely new to this scripting so i appreciate the patience.
i'm trying to wrap my head around how and where i insert the code you show to attain the session name into my basic script.

here is my latest script which is decent for my needs, i just prefer to add the session name as opposed to the host ip.

Code:
Sub Main
    crt.Screen.Send "copy run tftp" & chr(13)
    crt.Screen.WaitForString "]? "
    crt.Screen.Send chr(13)
    crt.Screen.WaitForString "]? "
    crt.Screen.Send "1.1.1.1" & chr(13)
    crt.Screen.WaitForString "]? "
    crt.Screen.Send crt.Session.RemoteAddress & "-" & Month(date) & Day(date) & Year(date) & "-" & Hour(time) & Minute(time) & Second(time) & ".cfg" & chr(13)
End Sub

Last edited by jdev; 08-25-2016 at 04:30 PM.
Reply With Quote
  #6  
Old 08-25-2016, 04:40 PM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
You're my hero, I figured it out, thank you.

One last question since you seem like you really know this.

My customers often share their session folder with me so i don't have to add all of the sessions manually.
With that said, some of the names have a comma or space in the session name.
And with this new script it doesn't like transferring a file with that comma or space in the session name.

Is there a way to strip them out like you split the path to get the name?

Here is my latest rev on the script with the code you provided.

Quote:
Sub Main

' Get the current session's path:
strSessionPath = crt.Session.Path

' Get the session's parent folder -- as displayed in the Connect dialog:
Set fso = CreateObject("Scripting.FileSystemObject")
strParentFolder = fso.GetParentFolderName(strSessionPath)
If strParentFolder = "" Then strParentFolder = "[\]"

' Get the current Session's name:
strSessionName = fso.GetFileName(strSessionPath)


crt.Screen.Send "copy run tftp" & chr(13)
crt.Screen.WaitForString "]? "
crt.Screen.Send chr(13)
crt.Screen.WaitForString "]? "
crt.Screen.Send "1.1.1.1" & chr(13)
crt.Screen.WaitForString "]? "
crt.Screen.Send strSessionName & "-" & crt.Session.RemoteAddress & "-" & Month(date) & Day(date) & Year(date) & "-" & Hour(time) & Minute(time) & Second(time) & ".cfg" & chr(13)
End Sub
Reply With Quote
  #7  
Old 08-25-2016, 04:48 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,021
Quote:
Originally Posted by mike1572 View Post
i am extremely new to this scripting so i appreciate the patience. i'm trying to wrap my head around how and where i insert the code you show to attain the session name into my basic script.
A picture is worth 1000 words (well, 986 in this case, since I used 14 words in the picture):
You don't really need the two lines that reference strParentFolder, so you can omit them if you want to keep your code clean of unused cruft.

--Jake
Attached Images
File Type: png ForumThread12456_CodeExplain.png (58.2 KB, 1385 views)
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #8  
Old 08-25-2016, 05:00 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,021
[QUOTE=mike1572;46248]You're my hero, I figured it out, thank you./QUOTE]

Looks like you're getting faster with your solutions that I am with my suggestions... Nice work.

Quote:
...it doesn't like transferring a file with that comma or space in the session name. Is there a way to strip them out like you split the path to get the name?
VBScript supports a native Replace() function.

Example:
Code:
strSessionName = Replace(strSessionName, ",", "")
strSessionName = Replace(strSessionName, " ", "")
Or, if you want to use _ instead of eliminating comma/space:
Code:
strSessionName = Replace(strSessionName, ",", "_")
strSessionName = Replace(strSessionName, " ", "_")
--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #9  
Old 08-25-2016, 05:04 PM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
Thank you for all your help here.

I have used SecureCRT for some time now and even talk my customers in to purchasing it after i show them the way it can make life simpler if you are a network engineer.

Lately I've been playing with features that even go further like this and the button bar and the keywords for highlighting text so it is easier to read.

Great product, thank you for all the help!!
Reply With Quote
  #10  
Old 08-25-2016, 05:14 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,021
Glad to help with making life easier for you.

How much time would you estimate this script saves you compared to what you would normally/manually do?

How often do you think it will be useful for you in the future?

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #11  
Old 08-26-2016, 09:36 AM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
Being a network engineer for a Cisco partner, I do a lot of break fix and logical changes on devices every day.

The repetitive nature of needing to backup the configurations before and after the changes i make to a customers device is a lot on a daily basis.

This script will serve me well for a while.

I am considering setting the sessions to automatically run after connection so i don't have to do it ever again before i make changes. That is why i wanted the filename to have such granularity down to the seconds.

Here is the final script as i have it, in case anyone else out there needs the same automation. Simply replace the IP address with the IP of your TFTP server.

This one works on CISCO ASA's;

Code:
Sub Main
' Get the current session's path:
	strSessionPath = crt.Session.Path

' Get the session's parent folder -- as displayed in the Connect dialog:
	Set fso = CreateObject("Scripting.FileSystemObject")
	strParentFolder = fso.GetParentFolderName(strSessionPath)
	If strParentFolder = "" Then strParentFolder = "[\]"

' Get the current Session's name:
	strSessionName = fso.GetFileName(strSessionPath)

	strSessionName = Replace(strSessionName, ",", "_")
	strSessionName = Replace(strSessionName, " ", "_")


	crt.Screen.Send "copy run tftp" & chr(13)
	crt.Screen.WaitForString "]? "
	crt.Screen.Send chr(13)
	crt.Screen.WaitForString "]? "
	crt.Screen.Send "208.40.72.165" & chr(13)
	crt.Screen.WaitForString "]? "
	crt.Screen.Send strSessionName & "-" & crt.Session.RemoteAddress & "-" & Month(date) & Day(date) & Year(date) & "-" & Hour(time) & Minute(time) & Second(time) & ".cfg" & chr(13)
End Sub
This one works on Switches and routers;

Code:
Sub Main
' Get the current session's path:
	strSessionPath = crt.Session.Path

' Get the session's parent folder -- as displayed in the Connect dialog:
	Set fso = CreateObject("Scripting.FileSystemObject")
	strParentFolder = fso.GetParentFolderName(strSessionPath)
	If strParentFolder = "" Then strParentFolder = "[\]"

' Get the current Session's name:
	strSessionName = fso.GetFileName(strSessionPath)

	strSessionName = Replace(strSessionName, ",", "_")
	strSessionName = Replace(strSessionName, " ", "_")


	crt.Screen.Send "copy run tftp" & chr(13)
'	crt.Screen.WaitForString "]? "'
'	crt.Screen.Send chr(13)'
	crt.Screen.WaitForString "]? "
	crt.Screen.Send "208.40.72.165" & chr(13)
	crt.Screen.WaitForString "]? "
	crt.Screen.Send strSessionName & "-" & crt.Session.RemoteAddress & "-" & Month(date) & Day(date) & Year(date) & "-" & Hour(time) & Minute(time) & Second(time) & ".cfg" & chr(13)
End Sub
The difference above is that the ASA prompts for the source filename and requires an "enter" to be sent. Whereas the switches and routers do not.

Need to create an if statement looking for if that first waitfor has the string of the filename or the string for the destination IP, then i can combine these into 1 script.

Here are the prompts for both types if you have any ideas.

ASA
Code:
LAC80L3ASA1# copy run tftp

Source filename [running-config]? 

Address or name of remote host []? 1.1.1.1

Destination filename [running-config]? 
Cryptochecksum: 73f039e7 c41f15f5 1e746283 2856fbee
SWITCH
Code:
MROSS_3560_Office#copy run tftp
Address or name of remote host []? 1.1.1.1
Destination filename [mross_3560_office-confg]? 
.....
%Error opening tftp://1.1.1.1/mross_3560_office-confg (Timed out)
Reply With Quote
  #12  
Old 08-26-2016, 11:33 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,021
Quote:
Originally Posted by mike1572 View Post
Being a network engineer for a Cisco partner, I do a lot of break fix and logical changes on devices every day.

The repetitive nature of needing to backup the configurations before and after the changes i make to a customers device is a lot on a daily basis.

This script will serve me well for a while.

I am considering setting the sessions to automatically run after connection so i don't have to do it ever again before i make changes. That is why i wanted the filename to have such granularity down to the seconds.
Sounds like SecureCRT is providing you a really good ROI!

Quote:
The difference above is that the ASA prompts for the source filename and requires an "enter" to be sent. Whereas the switches and routers do not.

Need to create an if statement looking for if that first waitfor has the string of the filename or the string for the destination IP, then i can combine these into 1 script.

Here are the prompts for both types if you have any ideas.
I do have some ideas...
What you'll find below is a stream of consciousness that includes code that, while it may look pretty, it hasn't been tested in any way shape or form. So it may very well need adjustment, syntax error correction, spell checking, etc. It's given as a way forward for you to learn from, not as a "Hey! This will really work for you, man..."

First, instead of using a hard-coded "1.1.1.1" for the TFTP server, you could set it to a variable high/early in your script code where it would be easy to find/edit/modify if your TFTP server ever changed:
Code:
strTFTPServerAddress = "1.1.1.1"
Next, you'll want to keep the 'copy run tftp' "send" from your original code...
Code:
' Here's the line from your original code:
crt.Screen.Send "copy run tftp" & vbcr
...but after that, you'll want to use something different than merely sequential statements of code.

In handling scenarios where you can receive any number of different responses/prompts from the remote -- each one requiring a different reply or sequence in the reply structure -- the pattern you want to implement is called a "state machine". Here's one idea of how you'd handle the ASA vs. Switch/router scenario in a single script:

Code:
' Create an array of possible text "tags" that could
' appear from the remote that would each need unique action.
strASASourceFilePrompt = "Source filename [running-config]?"
strRemoteAddressPrompt = "Address or name of remote host []?"
strDestinationFilename = "Destination filename ["
strShellPromptTermChar = "#"
vWaitFors = Array(_
    strASASourceFilePrompt, _
    strRemoteAddressPrompt, _
    strDestinationFilename, _
    strShellPromptTermChar
    )

' Enter a state machine so that whenever text appears from
' the remote, we can act on it no matter the order in
' which they arrive:
Do
    ' Wait for any of our "tags" to arrive from the remote
    crt.Screen.WaitForStrings(vWaitFors)
    
    ' Now, decide what to do based on which "tag" was found.
    ' Note that crt.Screen.MatchIndex will only return a 0
    ' if we have a timeout param in WaitForString()... you don't
    ' have a timeout param (because you always expect something
    ' in vWaitFors will show up), so crt.Screen.MatchIndex will
    ' always be 1 greater than the corresponding index of the
    ' item in the vWaitFors array. So, we'll need to subtract 1
    ' from the MatchIndex in order to arrive at the corresponding
    ' vWaitFors array index:
    Select Case vWaitFors(crt.Screen.MatchIndex - 1)
    
        Case strASASourceFilePrompt
            ' What do you do when an ASA source file prompt
            ' appears? You press Enter, which sends a CR:
            crt.Screen.Send vbcr
            
            ' Now the script will loop to the top of the "Do"...
            
        Case strRemoteAddressPrompt
            ' What do you do when you are prompted for the
            ' remote address of the TFTP server? You "Enter"
            ' it.
            crt.Screen.Send strTFTPServerAddress & vbcr

            ' Now the script will loop to the top of the "Do"...

        Case strDestinationFilename
            ' First, wait for the "]?" to appear so that we
            ' don't end up sending something to the remote
            ' side too quickly. It's known that Cisco devices
            ' don't like it when data is sent too quickly, so
            ' we'll be extra cautious here. We don't know if
            ' we're dealing with an ASA or a switch, and since
            ' they're both going to send different data, we'll
            ' just wait for the end of the line prompt to appear:
            crt.Screen.WaitForString("]?")
            
            ' Send the file name using your specially-crafted
            ' session-ip-MDY-HMS.cfg pattern:
            crt.Screen.Send _
                strSessionName & "-" & crt.Session.RemoteAddress & "-" & _
                Month(date) & Day(date) & Year(date) & "-" & _
                Hour(time) & Minute(time) & Second(time) & ".cfg" & vbcr

            ' Now the script will loop to the top of the "Do"...

        Case strShellPromptTermChar
            ' We got a shell prompt terminator, meaning we're done
            ' with our state machine loop. Instead of looping to
            ' the top of the "Do", we'll exit the "Do".
            ' (sounds like a good hair day, maybe)
            Exit Do
            
        Case Else
            crt.Dialog.MessageBox _
                "Looks like you've boldly added a new entry " & _
                "to your 'vWaitFors' array, but you have not " & _
                "yet added any 'Case' statement to do something " & _
                "about it when it arrives:" & vbcrlf & vbcrlf & _
                """" & vWaitFors(crt.Screen.MatchIndex) & """" & _
                vbcrlf & vbcrlf & _
                "Edit your script code to add a Case statement " & _
                "to handle this scenario, and then run your script " & _
                "again."
            ' Since this is an error condition, we don't want to loop
            ' to the top of the "Do". So, after displaying the error
            ' along with helpful encouragement, we'll exit the "Do"
            ' (sounds like a bad hair day)
            Exit Do
            
    End Select
Loop
Hope it helps not only you, but also the forum community at large (not that there's a man hunt under way or anything like that... it's just an expression).

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #13  
Old 08-27-2016, 11:47 AM
mike1572 mike1572 is offline
Registered User
 
Join Date: Apr 2010
Posts: 10
Works like a charm.
Thank you again.

Also i believe this script will help going forward as a great "template" or guideline for creating other scripts that have the same wait for this and send that type format.

Here is the final script that is now working for all devices regardless of type.

Code:

'Initial command to start the copy to TFTP'
	crt.Screen.Send "copy run tftp" & chr(13)

' Get the current session's path:
	strSessionPath = crt.Session.Path
'IP Address of TFTP server'	
	strTFTPServerAddress = "1.1.1.1"

' Get the session's parent folder -- as displayed in the Connect dialog:
	Set fso = CreateObject("Scripting.FileSystemObject")
	strParentFolder = fso.GetParentFolderName(strSessionPath)
	If strParentFolder = "" Then strParentFolder = "[\]"

' Get the current Session's name:
	strSessionName = fso.GetFileName(strSessionPath)

	strSessionName = Replace(strSessionName, ",", "_")
	strSessionName = Replace(strSessionName, " ", "_")


' Create an array of possible text "tags" that could
' appear from the remote that would each need unique action.
strASASourceFilePrompt = "Source filename [running-config]?"
strRemoteAddressPrompt = "Address or name of remote host []?"
strDestinationFilename = "Destination filename ["
strShellPromptTermChar = "#"
vWaitFors = Array(_
    strASASourceFilePrompt, _
    strRemoteAddressPrompt, _
    strDestinationFilename, _
    strShellPromptTermChar)

' Enter a state machine so that whenever text appears from
' the remote, we can act on it no matter the order in
' which they arrive:
Do
    ' Wait for any of our "tags" to arrive from the remote
    crt.Screen.WaitForStrings(vWaitFors)
    
    ' Now, decide what to do based on which "tag" was found.
    ' Note that crt.Screen.MatchIndex will only return a 0
    ' if we have a timeout param in WaitForString()... you don't
    ' have a timeout param (because you always expect something
    ' in vWaitFors will show up), so crt.Screen.MatchIndex will
    ' always be 1 greater than the corresponding index of the
    ' item in the vWaitFors array. So, we'll need to subtract 1
    ' from the MatchIndex in order to arrive at the corresponding
    ' vWaitFors array index:
    Select Case vWaitFors(crt.Screen.MatchIndex - 1)
    
        Case strASASourceFilePrompt
            ' What do you do when an ASA source file prompt
            ' appears? You press Enter, which sends a CR:
            crt.Screen.Send vbcr
            
            ' Now the script will loop to the top of the "Do"...
            
        Case strRemoteAddressPrompt
            ' What do you do when you are prompted for the
            ' remote address of the TFTP server? You "Enter"
            ' it.
            crt.Screen.Send strTFTPServerAddress & vbcr

            ' Now the script will loop to the top of the "Do"...

        Case strDestinationFilename
            ' First, wait for the "]?" to appear so that we
            ' don't end up sending something to the remote
            ' side too quickly. It's known that Cisco devices
            ' don't like it when data is sent too quickly, so
            ' we'll be extra cautious here. We don't know if
            ' we're dealing with an ASA or a switch, and since
            ' they're both going to send different data, we'll
            ' just wait for the end of the line prompt to appear:
            crt.Screen.WaitForString("]?")
            
            ' Send the file name using your specially-crafted
            ' session-ip-MDY-HMS.cfg pattern:
            crt.Screen.Send _
                strSessionName & "-" & crt.Session.RemoteAddress & "-" & _
                Month(date) & Day(date) & Year(date) & "-" & _
                Hour(time) & Minute(time) & Second(time) & ".cfg" & vbcr

            ' Now the script will loop to the top of the "Do"...

        Case strShellPromptTermChar
            ' We got a shell prompt terminator, meaning we're done
            ' with our state machine loop. Instead of looping to
            ' the top of the "Do", we'll exit the "Do".
            ' (sounds like a good hair day, maybe)
            Exit Do
            
        Case Else
            crt.Dialog.MessageBox _
                "Looks like you've boldly added a new entry " & _
                "to your 'vWaitFors' array, but you have not " & _
                "yet added any 'Case' statement to do something " & _
                "about it when it arrives:" & vbcrlf & vbcrlf & _
                """" & vWaitFors(crt.Screen.MatchIndex) & """" & _
                vbcrlf & vbcrlf & _
                "Edit your script code to add a Case statement " & _
                "to handle this scenario, and then run your script " & _
                "again."
            ' Since this is an error condition, we don't want to loop
            ' to the top of the "Do". So, after displaying the error
            ' along with helpful encouragement, we'll exit the "Do"
            ' (sounds like a bad hair day)
            Exit Do
            
    End Select
Loop
I have attached it as a text file. Simply change it to a ".vbs" to use with your SecureCRT.
Remember to change the TFTP IP address to match yours.
Attached Files
File Type: txt new-copy.txt (4.7 KB, 209 views)
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 04:27 PM.