Jump to content
Sign in to follow this  

Capturing info on hyperlink

Recommended Posts


I'm making a script that will look at a table, and capture the data. So far I have 2 issues, and I'm addressing the first issue in a different thread. The second issue should be simple to do, but I can't figure out after reading the help file and searching the forum. I'm looking to do this:

$oIE = _IE_Example ("table")
$colTables = _IETableGetCollection ($oIE, 1)
$n =1
$avTable = _IETableWriteToArray ($colTables) ;this writes the data that is VIEWABLE to the user. It will not collect hyperlink info
$oLinks = _IELinkGetCollection ($oIE) ;This gets the hyperlinks, but doesn't say how to index them. ????? How do you get the index so you can pick??
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")

The above example has no hyperlinks in _IE_Example ("table"), However for sake of argument, say column 0 has a hyperlink in each cell. In this case, you would get back 5 hyperlinks. my question is this:

How do I get the hyperlink I want from the table? My plan is to:

  • reach row from the table
  • Look at column 0 of the row, and get the hyperlink info - This includes the seen text and the link itself
  • write the row to a HTML page, so that it will scroll in a marquee. The hyperlink will show in the scroll.
I do not know how to access the index of hyperlinks. Can someone show me? Yes, I've stared at the helpfile until I'm blue in the face. :rolleyes:

Share this post

Link to post
Share on other sites

Never mind, I figured it out.

$oIE = _IECreate ("http://somewebpagehere.com", 0, 0)
$oIE1 = _IECreate ()
$colTables = _IETableGetCollection ($oIE, 1)
$n =1
$avTable = _IETableWriteToArray ($colTables)
$oLinks = _IELinkGetCollection ($oIE, $e)
$iNumLinks = $oLinks.href
$makemarquee = _IEDOCWriteHTML($oIE1, '<body scroll=no topmargin=0 BGCOLOR=LTGREEN><marquee SCROLLAMOUNT=2 ><a href= "'&$iNumLinks&'">'& $avTable[0][$e]&'</marquee></body>')

Share this post

Link to post
Share on other sites

Is there an actual website we can test this on?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post

Link to post
Share on other sites

I would think something more like this...

#include <IE.au3>

$oIE1 = _IECreate()
$oIE2 = _IECreate("http://www.autoitscript.com", 0, 0)
$oLinks = _IELinkGetCollection($oIE2)
$sText = ""
For $oLink In $oLinks
    If String($oLink.outerText) = "0" Then ContinueLoop
    $sText &= '<a href= "' & $oLink.href & '">' & $oLink.outerText & "<br />"
_IEDocWriteHTML($oIE1, '<body scroll=no topmargin=0 BGCOLOR=LTGREEN>' & _
        '<marquee SCROLLAMOUNT=2 >' & $sText & '</marquee></body>')

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.