View Single Post
  #2  
Old 11-01-2013, 10:32 AM
rtb rtb is offline
VanDyke Technical Support
 
Join Date: Aug 2008
Posts: 4,305
Hi olivebranch2006,

I have gone through the script code, and all of the problems you are seeing and will see are VBScript syntax errors rather than problems with SecureCRT. You may consider taking a look at the scripting manual that we have published at the following location:
http://www.vandyke.com/support/tips/...ing/index.html
In the first chapter of the scripting manual, we point to the Microsoft documentation on VBScript. You may want to familiarize yourself with VBScript before diving into the scripting manual.

The error you are seeing can mean that you are missing one part of a pair of statements or keywords, but it can also point to other issues in the script code. When a syntax error is encountered by a script engine, it is not always clear what was originally intended by the script author. The information that the script engine is able to provide can sometimes be difficult to interpret.

Here is an example that illustrates proper syntax and ways to make code more readable:
Code:
crt.Screen.Synchronous = True
crt.Screen.WaitForStrings "1","2","3","4"
Select Case crt.Screen.MatchIndex
    Case 1
        nNum = 1
    Case 2
        nNum = 2
    Case 3
        nNum = 3
    Case 4
        nNum = 4
End Select

If nNum = 1 Then F1

If nNum = 2 Then 
    F1
    F2
End If

If nNum = 3 Then
    F1
    F2
    F3
End If

If nNum = 4 Then
    F1
    F2
    F3
    F4
End If

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub F1()
    MsgBox "Entered subroutine 1."
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub F2()
    MsgBox "Entered subroutine 2."
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub F3()
    MsgBox "Entered subroutine 3."
End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sub F4()
    MsgBox "Entered subroutine 4."
End Sub
__________________
--Todd

VanDyke Software
Technical Support
support@vandyke.com
505-332-5730

Last edited by rtb; 11-04-2013 at 03:34 PM.
Reply With Quote