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.

Quick Explanation of the Internet Application Object Model


Question:

The code below (or something similar...) seems to show up in a lot of webboard posts.

My question is:
What do the 3 lines starting with the comment "setup the document object" do?
How generic are they?

#definesubroutine startMSIE(url)
	Browser = objectopen("InternetExplorer.Application")
	Browser.addressbar = @false
	Browser.statusbar = @false
	Browser.menubar = @false
	Browser.toolbar = @false
	browser.visible = @true
	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



Answer:

; setup the document object...
browserDoc = Browser.Document
all = browserdoc.all
Quick answer:

When you navigate to an HTML page the HTML is contained inside what MSHTML (microsoft HTML) calls a ".Document". Inside the document is everything contained in the document or what MSHTML refers to is ".All" (all objects, collections etc).

From there it's possible to break it down into smaller and smaller portions, where you can refer to a specific item on the page.

The object model uses two sources (primarily)

The browser (the program that supports HTML) and the MSHTML (the actual HTML details).

Long answer:

If you have MS Office, open MS Excel hit ALT-F11 and you'll see the VBA Editor.

Go up to the TOOLS menu and click REFERENCES. Go down the list until you find the section that starts with Microsoft.

Check:

Click OK, and then hit F2. The object browser opens. Go up to the top where it says ALL LIBRARIES and find SHDOCVW and click it.

Down below, click on INTERNETEXPLORER. See if you can find all the items coded up to and including .Document

Then once you do, go up and change SHDOCVW with MSHTML. Find HTMLDOCUMENT (where you saw INTERNETEXPLORER) and click it.

You've now found the link from the browser to the actual HTML.

Now depending on your knowledge and resourcefulness you have to find how each of these link to other parts of the HTML.


Article ID:   W16131
File Created: 2004:08:02:10:52:46
Last Updated: 2004:08:02:10:52:46