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.

List Links on a Webpage

 Keywords:  list link web page

Sample:

This sample will show all the links on a web page you're on, which is easier than parsing the HTML. Note: you need to supply the appropriate URL...

Browser = ObjectCreate("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:   W15264
File Created: 2009:01:29:08:16:34
Last Updated: 2009:01:29:08:16:34