VBS filter on multiple words

Discuss anything here related to the large world of computers and electronics, whether you're asking for help, wanting to learn more, or just want to share some intellect with your fellow forumers.
Locked
User avatar
lightnessking.
Nemesis
Posts: 2050
Joined: Fri Nov 27, 2009 9:27 pm

VBS filter on multiple words

Post 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.)
You cannot make another post so soon after your last.

Locked

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 12 guests