Page 1 of 1

VBS filter on multiple words

Posted: Wed Mar 07, 2012 4:13 am
by lightnessking.
Nevermind, got it working : )))

Hey, does anyone with VBS expierence know how to filter on multiple words? This is a part of my array.

Code: Select all

set services = CreateObject( "System.Collections.ArrayList" )
services.add "print" 
services.add "DNS"
services.add "DHCP"
services.add "remote desktop services"
services.add "file replication service"
I'm using the parser to split lines in windows 2008 event logs (at the General text box.).
For print/DNS/DHCP it works perfectly, tho when I want to filter on multiple words at once then I need a for loop, but I don't have a clue how, and google won't help me enough lol.

now this is my split function(s):

Code: Select all

public function checklines(tekst, checkword)
lines = split(tekst, vbcrlf)

for each line in lines
'wscript.echo line
if hasword(line, checkword) then 
'geef antwoord true
'wscript.echo "checklines = true"
checklines = true
end if
next
if checklines = null then
checklines=false
end if 
end function

public function hasword(line, checkword)
words = split(line, " ")
for each word in words
'wscript.echo word
if LCase(word) = LCase(checkword) then
'wscript.echo "hasword = true"
hasword=true
End If
Next
if hasword = null then
hasword=false
end if
end function
How can I implement a "for loop", so I can filter on multiple words ?(with spaces.)