catching an event in VBScript

Posted by be here now on Stack Overflow See other posts from Stack Overflow or by be here now
Published on 2010-03-19T17:19:51Z Indexed on 2010/03/19 17:21 UTC
Read the original article Hit count: 197

Filed under:
|
|
|

Hi, guys. This is a VBS script that opens google, fills a form, and clicks a search button.

set ie = CreateObject("InternetExplorer.Application")

ie.navigate("www.google.com")

ie.visible = true

while ie.readystate <> 4
    wscript.sleep 100
WEnd

set fields = ie.document.getelementsbyname("q")
set buttons = ie.document.getelementsbyname("btnG")

fields(0).value = "some query"
buttons(0).click

ie.quit

Sub OnClickSub()
    MsgBox  "button clicked!", 0
End Sub

Obviously, buttons(0).click fires an onclick event of the button, which I somehow need to catch in my script, and provide it with some processing like launching OnClickSub().

Has anyone got any ideas how this should be done?

© Stack Overflow or respective owner

Related posts about vbscript

Related posts about dom