0

When I run my Script on the server I get the : expected statement

My code

if STATUS = "ERROR" then
    ext = LCase(FSO.GetExtensionName(sNewestFile))
    ' ZIP and RAR handler
    ' What should it do of the ext variable is zip or Rar?
    ' it is specified in the cases.
    Select Case ext
            Case "log", "txt"
                'Runs the tail.exe file to get the last 10 lines of text in the [sNewestFile] and insert them to the log file.
                'This will only be done IF there is a status = "ERROR"
                errorStr = WScript.CreateObject("WScript.Shell").Exec( _ "tail -n 10 """ & sNewestFile & """" _ ).StdOut.ReadAll 
                objLogFile.writeline "" & vbCrLf
                objLogFile.writeline "Error Message Start" & vbCrLf
                objLogFile.writeline "" & errorStr & vbCrLf
                objLogFile.writeline "Error Message End" 
            Case "zip"
                objLogFile.writeline "" & vbCrLf
                objLogFile.writeline "The Date of the ZIP file is to old" & vbCrLf
            Case "rar"
                objLogFile.writeline "" & vbCrLf
                objLogFile.writeline "The Date of the RAR file is to old" & vbCrLf
    End Select 'Ends the Select Case ext
End If

The thing is that I keep getting somekind of error first it was invalid character I solved that by doing a prober if statement. Now its a expected statement.

I just cant seem to figurer out where, it goes wrong?

I've used the following for references:

1
  • Will this error occur if there is no Case Else in the select statement? Commented Sep 7, 2015 at 9:54

1 Answer 1

1

Appearently the solution was to use :

errorStr = WScript.CreateObject("WScript.Shell").Exec( _ 
      "tail -n 10 """ & sNewestFile & """" _ 
      ).StdOut.ReadAll

Instead of a 1 line :

errorStr = WScript.CreateObject("WScript.Shell").Exec( _ "tail -n 10 """ & sNewestFile & """" _ ).StdOut.ReadAll

Why it is this way I have to clue of.

Sign up to request clarification or add additional context in comments.

1 Comment

The _ indicates to the parser that the line has been split and the code continues in the next line. If you want all the code in one line, remove the underscores.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.