Reputation: 129
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:
Upvotes: 0
Views: 342
Reputation: 129
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.
Upvotes: 1