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.

Click Form Buttons

 Keywords: HTML IE forms Press Button 

Sample:

I found an easier way (at least I think so) to clicking buttons on HTML pages, than the WinInet extender. I can't do it due to proxy server issues, with the handle/url etc.

Save the following HTML as 'c:\temp\auto_click_form2.htm'

<body language="vbscript" OnLoad="windowLoad">

<script language=vbscript>
	sub cmdbutton1_onclick
		dim pin, from, subject
		pin = document.form1.pin.value
		from = document.form1.from.value
		subject = document.form1.subject.value
		alert pin & vbcrlf & from & vbcrlf & subject
	end sub
</script>

<FORM NAME="form1">
<INPUT TYPE=HIDDEN NAME=category VALUE=personal>
<INPUT TYPE="text" NAME="pin" SIZE="20" value="Box 1">
<INPUT TYPE="text" NAME="from" SIZE="20" value="Box 2">
<INPUT TYPE="text" NAME="subject" SIZE="25" value="Longer Box 3">
<INPUT TYPE="button" NAME="cmdbutton1" value="Click Me"> </FORM> </body>

Then run the following script

Browser = ObjectOpen("InternetExplorer.Application")
browser.visible = @true
url = "c:\temp\auto_click_form2.htm"
browser.navigate(url)
timedelay(2)

while browser.readystate <> 4
	timedelay(0.5)
endwhile

doc = browser.document
form1 = doc.form1
cbutton = form1.cmdbutton1
cbutton.click
exit

So, if you have a page with a NAMED form (such as the AT&T phone page) you can create a local HTML file (download theirs and cut & paste) and extend the "Post" line so that it has the full URL. Note: the VBSCRIPT in the HTML file is just so that you can see the button was clicked.


Article ID:   W15262
File Created: 2002:09:05:13:50:52
Last Updated: 2002:09:05:13:50:52