Jump to content

need help getting a name from a link

Recommended Posts

Okay I know that _IELinkClickByText ($oIE, "user forum") will click on the link called user forum. I'd like to be able to do the opposite, well kinda. I'd like a function that when pointed at a link will get that links name.

Heres an example of what I'd like

Page Source Code

<div class="barL">
        Hello,<a href="http://forums.d2jsp.org/index.php?showuser=230548">SteelersSuck<img height=10 width=10 src="/images/i3.gif"></a>
        <a href="http://forums.d2jsp.org/index.php?act=Login&CODE=03">Log Out</a>

$myname = somefunction($oIE,"http://forums.d2jsp.org/index.php?showuser=230548")

MsgBox(4096, "", $myname)

and this would display the name SteelersSuck in a MsgBox

Any suggestions would be appreciated.

The glass is neither half empty nor half full, it is simply twice as big as it needs to be.
Link to comment
Share on other sites

$oLinks = _IELinkGetCollection($oIE)
For $oLink in $oLinks
    ConsoleWrite(_IEPropertyGet($oLink, "innertext") & @CR)


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

cannot test due to no login info

; demonstration to find chracters that change between to standard points
; or just find a string
#include <IE.au3>
#include <String.au3>

#Region --- IE-Builder generated code Start ---

$oIE = _IECreate("about:blank", 0, 0)

;------------- User input --------------
_IENavigate($oIE, "http://forums.d2jsp.org/index.php?showuser=230548") ; web address
$Find = 'showuser=230548">'   ; my info shows after this line... or just find this line
$Before = '<img'     ; my info shows before this line... or set as ""
; ------------ End User input -------------

$body = _IEBodyReadHTML($oIE)
$sloc = @TempDir & "\test.txt" 
FileWrite($sloc, $body)
$sfile = FileOpen($sloc, 0)
$num = 0

While 2
    $num = $num + 1
    $sline = FileReadLine($sfile, $num)
    If @error Then
        MsgBox(262208, "Fail", "The string was NOT found   ")
    If StringInStr($sline, $Find) Then
        MsgBox(64, "Success", "The string " & $Find & " was found    " & @CRLF & " on line # " & $num, 5)
        If $Before = "" Then ExitLoop
        $Found = _StringBetween($sline, $Find, $Before)
        MsgBox(64, "Found", "The string is " & $Found[0] & "    ", 5)

#EndRegion --- IE-Builder generated code End ---



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

  • Recently Browsing   0 members

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