Sign in to follow this  
Followers 0
AdmiralAlkex

[SOLVED] Read link text (with IE UDF)

7 posts in this topic

#1 ·  Posted (edited)

Here's a html on my website to use as example:

http://hem.passagen.se/amax/CodecControl/index.html

(please excuse the ads and popup, it's one of those "free" hosts)

Getting links with IE UDF is easy;

$oIE = _IECreate("http://hem.passagen.se/amax/CodecControl/index.html", 0, 1, 1, 0)

$oFrame = _IEFrameGetCollection($oIE, 1)
$oLinks = _IELinkGetCollection($oFrame)
$iNumLinks = @extended
ConsoleWrite($iNumLinks & " links found" & @CRLF)
For $oLink In $oLinks
    ConsoleWrite($oLink.href & @CRLF)
    ConsoleWrite($oLink.title & @CRLF)
Next

;~ Sleep(10000) ;To see the page

_IEQuit($oIE)

But is there a way to get the links text? ("CodecControl 2.2.8" and "CodecControl 2.2.5")

Also, any guidence on how to have some data hidden that can in one way or another be associated with the links? Abusing the "title" is kinda weak.

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites



I can't find out how :)

Oops...

If the object is an element, the nodeValue returns null.

It's kind of misusing the property, but you can use .dataSrc as a custom string attribute:

#include <IE.au3>

$oIE = _IE_Example("basic")
$oLinks = _IELinkGetCollection($oIE)

$iIndex = 0
For $oLink In $oLinks
    $oLink.dataSrc = "#LinkCustomData_" & $iIndex
    $iIndex += 1
Next

For $oLink In $oLinks
    ConsoleWrite(".innerText = " & $oLink.innerText & "; .dataSrc = " & $oLink.dataSrc & @LF)
Next

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0