Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find word in HTML page

Status
Not open for further replies.

Ragol1

Programmer
Oct 25, 2001
315
US
I have an HTML page that gets recreated every 2 minutes. I need to look for a word in this page every 10 seconds or so. If the word apprears then all is well, if it does not then I need to send an Email using ASPMAIL/CDONTS/CDOSYS any of the above.

Honeslty I want to set of a light, so if the word is there I send a OK signal and if it is not I send a turn light red signal, just an on or off USB light.

To start I just need to be able to scan the page for the word.

Thanks
 

If the page is refreshed every two minutes why do you want to check it every 10 seconds? nothing will be changed until the two minutes have passed...

anyway you could use the FileSystemObject to scan the file but if you give us an example of the page and the word you are looking for we might give you a more detailed answer.

N


 
It’s just an HTML page with a bunch of tables and names. Next to each name there is a status for that person. If the Status say "AVAIL" then all is well, if it says anything else then its not.

So basically I’m looking for the WORD "AVAIL" in the page

The page does refresh every 30 seconds, I wasn’t be literal.

If the word AVAIL is not in the page then I need it to send an Email, I was looking to parse the page from another page.

Thanks
 
You probably don't want to run the checker as an ASP page. You could very easily use a standalone VBScript to handle it.

To handle the remote connection to the page you can use the XMLHTTP object to make the query and get a copy of the page.
Here is an example designed fior use in a script (instead of an ASP page):
Code:
'Setup the 
Dim objHTTP
Set objHTTP = CreateObject("Microsoft.XMLHTTP")
objHTTP.Open "GET","[URL unfurl="true"]http://www.somewhere.com/somepage.html",false[/URL]
objHTTP.Send

Dim resp
If objHTTP.Status <> 200 Then
   'error, 404/501/etc came back
   echo "Error: HTTP Status " & objHTTP.Status
Else
   'got a response
   resp = objHTTP.ResponseText
   If InStr(resp,"AVAIL") > 0 Then
      echo "Found AVAIL!"
   Else
      echo "Didn't Find AVAIL!"
   End If
End If

Making this script run every 10 seconds would be the hard part. I think the smallest amount of time available in scheduled tasks is a minute.

Depending on what type of component your planning on plugging into yor USB port and communicating with, you may or may not be able to do this in VBScript. If it is an off-the-shelf component with an API + DLL then you should be able to register the DLL and communicate with it. If this is something your wiring yourself you will either need to write your own DLL or do all of the code in a deeper language.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top