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 Code to Return Links and Anchors on Webpage

Keywords: 	 number of links number of anchors

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

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

BrowserDoc = Browser.Document
Links = BrowserDoc.Links
numberofLinks = Links.Length
message("Links", "There are %numberofLinks% Links in this Web Page")
numberofLinks = Links.Length - 1

;;;;;;; only show the first 3 Links TOO MANY!!!
for x = 0 to 2 ;numberofLinks
        Links = BrowserDoc.Links(x)
        message("Debug", Links.href)
next

anchors = browserdoc.anchors
numberofAnchors = anchors.length
message("Anchors", "There are %numberofAnchors% Anchors in this Web Page")
numberofAnchors = anchors.length - 1

for x = 0 to numberofAnchors
        thisanchor = browserdoc.anchors(x)
        message("Debug", thisanchor.name)
next

Images = BrowserDoc.Images
numberofImages = Images.Length
message("Images", "There are %numberofImages% Images in this Web Page")
numberofImages = Images.Length - 1

for x = 0 to numberofImages
        Images = BrowserDoc.Images(x))
        message("Debug", Images.src)
next

exit

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