mrxMonster, ясно. Тогда,
возможно, будет удобнее перебором всего, что есть в указанной папке:
Код:
Код: Выделить всё
Option Explicit
Const ForReading = 1
Const cdoSendUsingPort = 2
Const cdoBasic = 1
Const strPartSchema = "http://schemas.microsoft.com/cdo/configuration/"
Dim strLog
Dim strLine
Dim dtDateTime
strLogPath = "E:\Песочница\0092"
With WScript.CreateObject("Scripting.FileSystemObject")
If .FolderExists(strLogPath) Then
For Each objFile In .GetFolder(strLogPath).Files
With objFile.OpenAsTextStream(ForReading)
Do Until .AtEndOfStream
strLine = .ReadLine()
Loop
.Close
End With
dtDateTime = CDate(Split(strLine)(0) & " " & Split(strLine)(1))
If DateDiff("d", dtDateTime, Now()) <= 1 Then
If UCase(Split(strLine)(3)) = UCase("Warning") Then
With WScript.CreateObject("CDO.Message")
With .Configuration.Fields
.Item(strPartSchema & "sendusing") = cdoSendUsingPort
.Item(strPartSchema & "smtpauthenticate") = cdoBasic
.Item(strPartSchema & "smtpserver") = "smtp.mail.ru"
.Item(strPartSchema & "smtpserverport") = 25
.Item(strPartSchema & "sendusername") = "login"
.Item(strPartSchema & "sendpassword") = "password"
.Update
End With
.To = "to@mail.com"
.From = "from@mail.com"
.Subject = "Subject"
.TextBody = strLine
.Send
End With
End If
End If
Next
Else
WScript.Echo "Log Folder [" & strLogPath & "] not found"
End If
End With
WScript.Quit 0
Если у всех лог-файлов одинаковое расширение — можно сделать условие, чтобы при переборе отбирались именно файлы с таким расширением (так сказать, некоторая защита от случайно попавших в папку файлов).