Jump to content

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:
Link to comment
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>')
Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

  • Moderators

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 />"
Next
_IEQuit($oIE2)
_IEDocWriteHTML($oIE1, '<body scroll=no topmargin=0 BGCOLOR=LTGREEN>' & _
        '<marquee SCROLLAMOUNT=2 >' & $sText & '</marquee></body>')
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...