Tom
Thu May 01 11:27:10 CDT 2008
On May 1, 11:50 am, Joe <J...@discussions.microsoft.com> wrote:
> Is it possible to have a VBScript open a webpage and look for specific words
> on the returned HTML?
>
> This would have to be able to run as an automated script launched through
> Scheduled Tasks.
>
> Any ideas would be helpful.
The short answer is Yes, but it might take more explaination to say
how easy or hard it would be. If it is simply to match the presence
of word or words, I would approach a scheduled job with something like
this ...
'<warning>
'<aircode>
' Create an xmlhttp object:
With CreateObject("MSXML2.XMLHTTP")
.open "GET", sURL, False
.send
Do Until .readyState = 4 : Wscript.Sleep 50 : loop
sPageText = .responseText ' or responseHTTP, or responsebody (BIN)
end with
if Instr(sPageText, "Your Match String") > 0 Then
with CreateObject("Scripting.FileSystemObject)
with .OpenTextFile("C:\Somewhere\logfile.log, 8)
.writeline "Found Match: : & Now()
end with
end with
end if
end with
</aircode>
</warning>
If you want to parse the page more than something like that, you might
want to take advantage of the DOM, but without some specifics it would
be to no ones advantage to say more - except that it can be done with
the IE.Application object - or maybe RegEx.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/