arajesha
Technical User
- Feb 13, 2015
- 1
Hi All,
I have mentioned the code, which we use, I am getting the following error in line ""last = lstmsg.ReadLine()"". Kindly help plzz.
if Date > strDate Then
strDate = Date
If Not objFSO.FolderExists("logs") Then
objFSO.CreateFolder("logs")
End If
MsgLogFileName = "logs//" & ComPort & "_" & "msg-" & Year(strDate) & Right("0" & Month(strDate), 2) & Right("0" & Day(strDate), 2) & ".log"
If objFSO.FileExists(MsgLogFileName) Then
Set MsgLogFile = objFSO.OpenTextFile(MsgLogFileName, FOR_APPENDING)
Else
Set MsgLogFile = objFSO.CreateTextFile(MsgLogFileName)
End If
end if
If objFSO.FileExists(lastmsg) Then
Set lstmsg = objFSO.OpenTextFile(lastmsg, FOR_READING)
last = lstmsg.ReadLine()
lstmsg.close
set lstmsg = nothing
cur = now
curr = Hour(cur)*3600 + Minute(cur)*60 + Second(cur)
diff = curr - last
Wscript.echo "diff = " & diff
if (diff > 0 and diff < 40) then
MsgLog("Less than 40 seconds..Time = " & cur )
Wscript.quit
end if
End if
I have mentioned the code, which we use, I am getting the following error in line ""last = lstmsg.ReadLine()"". Kindly help plzz.
if Date > strDate Then
strDate = Date
If Not objFSO.FolderExists("logs") Then
objFSO.CreateFolder("logs")
End If
MsgLogFileName = "logs//" & ComPort & "_" & "msg-" & Year(strDate) & Right("0" & Month(strDate), 2) & Right("0" & Day(strDate), 2) & ".log"
If objFSO.FileExists(MsgLogFileName) Then
Set MsgLogFile = objFSO.OpenTextFile(MsgLogFileName, FOR_APPENDING)
Else
Set MsgLogFile = objFSO.CreateTextFile(MsgLogFileName)
End If
end if
If objFSO.FileExists(lastmsg) Then
Set lstmsg = objFSO.OpenTextFile(lastmsg, FOR_READING)
last = lstmsg.ReadLine()
lstmsg.close
set lstmsg = nothing
cur = now
curr = Hour(cur)*3600 + Minute(cur)*60 + Second(cur)
diff = curr - last
Wscript.echo "diff = " & diff
if (diff > 0 and diff < 40) then
MsgLog("Less than 40 seconds..Time = " & cur )
Wscript.quit
end if
End if