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.

OLE - Reading a web page


Here's a quick example of how to read a web page. Run this AFTER you login to Winbatch BBS. It'll open MSIE, login to the webboard, find your post, open it and then show you the text of the post.
;using Winbatch 2004F, MSIE 6.

#definesubroutine startMSIE()
   Browser = objectopen("InternetExplorer.Application")
   Browser.addressbar = @false
   Browser.statusbar = @false
   Browser.menubar = @false
   Browser.toolbar = @false
   browser.visible = @true

   url = "http://webboard.winbatch.com/wbisadll/wbpx.isa/~winware" ;Notice: this forum is going to be archived. The new forum is http://forum.winbatch.com.

   browser.navigate(url)
   ;   wait until page loads...
   WaitForPageLoad()
   ;   setup the document object...
   browserDoc = Browser.Document
   all = browserdoc.all
   return(browser)
#endsubroutine

#DefineSubroutine WaitForPageLoad()  ; assume Browser
   While browser.busy || browser.readystate == 1
      TimeDelay(0.5)
   EndWhile
   While browser.Document.ReadyState != "complete"
      TimeDelay(0.5)
   EndWhile
   return
#EndSubroutine




;   set up what to do if the browser is closed before the script ends...
;IntControl(73, 1, 0, 0, 0)

br = startMSIE()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;         leave this section commented if you're already logged into Webboard...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;userIDField = all.name
;pwdField    = all.pass
;
;userIDField.value = "user"
;pwdField.value = "password"
;
;timedelay(5)
;
;form = all.form
;form.submit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

while Browser.busy || Browser.readystate <> 4
   timedelay(0.5)
endwhile

frames = browserdoc.frames

message("# of Frames on page...", frames.length)

;   point to the Left Frame object, loop thru its anchors and display them...
leftframe = frames.item(1)
ldoc = leftframe.document
lbody = ldoc.body

lanchors = lbody.GetElementsByTagname("A")

for x = 0 to lanchors.length-1
   AnchorObj = lanchors.item(x)
   if AnchorObj.innerText <> "" then message(strcat("Anchor # ", x+1, " of ", lanchors.length), AnchorObj.innerText)
   if AnchorObj.innerText == "reading screen responses"
      AnchorObj.click
      objectclose(AnchorObj)
      break
   endif
   objectclose(AnchorObj)
next

while Browser.busy || Browser.readystate <> 4
   timedelay(0.5)
endwhile

rightframe = frames.item(2)
rdoc = rightframe.document
rbody = rdoc.body

message("Debug", rbody.innerText)

exit




Article ID:   W16127
File Created: 2013:06:19:13:45:14
Last Updated: 2013:06:19:13:45:14