CSV parser using Vb Script

This csv parser can parse eventvwr events..

Dim openfile
Dim strnextline
Dim intsize
Dim i
intsize = 0
Const forreading = “1”
csvpath = “c:\applog.csv”
Searchstring = “,”
Errorcode = “1054”

Set fso = WScript.CreateObject(“Scripting.Filesystemobject”)
Set openfile = fso.OpenTextFile(csvpath,forreading)
strnextline = openfile.ReadLine

Do Until openfile.AtEndOfStream
strnextline = openfile.ReadLine
If InStr(strnextline,Searchstring)Then
If InStr(strnextline,Errorcode)Then
WScript.Echo(“all done”)
End If
End If

Public Sub ShowMessage(newarray)
WScript.Echo “Date:” & newArray(0)
WScript.Echo “Time:” & newarray(1)
WScript.Echo “Source:” & newArray(2)& ” “& newArray(3)
WScript.Echo “Server:” & newArray(7)
WScript.Echo “Message1:” & newArray(8)
WScript.Echo ” ”
End Sub


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s