Jump to content
Sign in to follow this  

IE Link object (obtain link text)

Recommended Posts


Just trying to get the text in an <a> tag

<a id="3734" href="#">Tuesday, March 12, 2013</a>

I want to obtain Tuesday, March 12, 2013 from the link.

Given my link object array is $aLinks,

$aLinks = _IELinkGetCollection($oTarget)
for $link in $aLinks
  if StringInStr($link.href, "http://URLtextToSearch") then
    ConsoleWrite($link.text & @CRLF)

at least I thought .text was the correct property but it's not. And my command works as I've tested it with ConsoleWrite($link.href & @CRLF) and $link.id as well

Edited by Mechaflash


“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”


Share this post

Link to post
Share on other sites

It's not .text but .innerHTML


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control


Share this post

Link to post
Share on other sites


I use routines similar to this for debugging sites that I scrape. The source in this example is a simple text file downloaded by inetget.

#include <IE.au3>

local $fln = 'k:\sd\sd0100\nba\boxes\400440940'         ; this is a text file downloaded with inetget

_get_links( fileread($fln) )
ConsoleWrite(@error & @LF)

func _get_links($html)

    Local $o_htmlfile = ObjCreate('HTMLFILE'), $str
    If Not IsObj($o_htmlfile) Then Return SetError(-1)


    Local $ocol = _IETagnameGetCollection($o_htmlfile, 'a')
    if not isobj($ocol) then return seterror(-2)

    for $o in $ocol
        ConsoleWrite('innertext = ' & $o.innertext & @LF)
        ConsoleWrite('href      = ' & $o.href & @LF)
        ConsoleWrite('-----------------------' & @LF)



Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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