1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Option Explicit
Const ForReading = 1
Const ForWriting = 2
Dim fso, fichLog, Ret, tmp, FichResult, Deb, Fin
Set fso = CreateObject("Scripting.FileSystemObject")
Set fichLog = fso.OpenTextFile("Logfile.log", ForReading, False)
Ret = ""
Set FichResult = fso.OpenTextFile("Resultat.log", ForWriting, True)
Do While Not fichLog.AtEndOfStream
tmp = fichLog.ReadLine
If tmp <> "" Then
' MsgBox EntreLimites(tmp)
FichResult.WriteLine AdapterInfos(tmp) & " = " & EntreLimites(tmp) ' On consigne le résultat dans un fichier !
End If
Loop
FichLog.Close
FichResult.Close
' =========================
Function EntreLimites(strIn)
Deb = InStr(strIn, "is now = ") + 9
strIn = Mid(strIn, Deb)
Fin = InStr(strIn, "]LOG") - 1
EntreLimites = Mid(strIn, 1, Fin)
End Function
'==========================
Function AdapterInfos(strAdapt)
Dim Debut, Fin
Debut = InStr(1, strAdapt, "OSDAdapter", 1)
Fin = InStr(1, strAdapt, "is now", 1) - 2
AdapterInfos = Mid(strAdapt, Debut, Fin - Debut + 1)
End Function |
Partager