WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with MSIE
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Determine if Check box is checked on Webpage


Question:

I'm have to check a site everyday to see if some new programs are available. I'd rather have my computer do that and then tell me only if there are new programs available. The web page is dynamically built, but there are tags with checkboxes. I'm trying to think of a good way to find out if those boxes are checked (new programs). The name of each of the INPUT tags is "checkbox###" (checkbox1, checkbox2, checkbox10, checkbox100, etc). Any ideas would be appreciated.

Answer:

Here is some OLE code you can try:


 ;-- Open Internet Explorer
 formname="frmTest"
 controlname = "chkTest"
 oIExplorer = ObjectOpen("InternetExplorer.Application")
 oIExplorer.Visible = @True
 ;-- Goto the HTML form 
 url = "file://c:\temp\Test.html"
 oIExplorer.Navigate(url)
 ;-- Wait
 While oIExplorer.Busy==1 || oIExplorer.ReadyState == 1
    TimeDelay(0.5)
 Endwhile
 myDoc=oIExplorer.Document
 myfrmTest=myDoc.%formname%
 ;-- CHECKBOX
 myChkTest=myfrmTest.%controlname%
 result=myChkTest.checked 
Message(controlname, result) ; 0 = unchecked 1 = checked


Here is the sample HTML Form:

<html><head><title>Test</title>
</head><body>
<p align="center"><big><strong>Test with IE and WB</strong></big></p>
<form name="frmTest">
<p><input name="chkTest" type="checkbox" value="ON" id="fp1">
<label for="fp1" accesskey="C"><U>C</U>heck</label></p>
<input type="submit" value="Enter" name="B1">
</p>
</form>
</body></html>

Article ID:   W17171
File Created: 2007:07:03:14:28:34
Last Updated: 2007:07:03:14:28:34