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.

Example of using the IE Object Interface

Keywords: 

Just wanted to post a working example of using the IE object interface.

I'm filling out and submitting a form, then dealing with the resulting pages. There's a second password prompt, which I fill the old fashioned (sendkey) way.

It works quite well!! This would have been MUCHO PAIN using the wininet extender!

userid = "admin@zammer.com"
pw = askpassword("enter password","enter password for %userid%")

which = askline("enter number", "enter machine number", 1) + 0

p2 = askpassword("enter password","enter machine password")

Browser = ObjectOpen("InternetExplorer.Application")
browser.visible = @true
url = "http://www.gotomypc.com"
browser.navigate(url)

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

BrowserDoc = Browser.Document

form = BrowserDoc.forms("LogIn")
if form == 0
; already logged in
else
x = form.elements
y = x.length

;for i = 0 to y-1
; z = form.elements(i)
; message("field",z.name)
;next i

a = form.elements("UserId")
a.value = userid

a = form.elements("Password")
a.value = pw

timedelay(2)

form.submit

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

timedelay(1.0)
links = browserdoc.links
numberofLinks = Links.Length
t = 0
for i = 0 to numberofLinks - 1
Links = BrowserDoc.Links(i)
s = Links.href
if strindex(s,"connect?",1,0)
t = t + 1
if t == which then break
endif
next
if i == numberoflinks then x=1/0

browser.navigate(s)

tit = "GoToMyPC - Enter Access Code"
if WinWaitExist(tit,40)
SendKeysTo(tit,p2)
SendKeysTo(tit,"{enter}")
endif

exit 

Article ID:   W15650
File Created: 2003:05:13:11:29:22
Last Updated: 2003:05:13:11:29:22