Jump to content
Sign in to follow this  
Symplystyc

need help getting a name from a link

Recommended Posts

Symplystyc

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>
    </div>

$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.

Share this post


Link to post
Share on other sites
DaleHohm

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

Dale


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

Share this post


Link to post
Share on other sites
Valuater

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

Sleep(1000)
$body = _IEBodyReadHTML($oIE)
$sloc = @TempDir & "\test.txt" 
FileDelete($sloc)
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   ")
        FileClose($sfile)
        Exit
    EndIf
    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)
        ExitLoop
    EndIf
WEnd

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

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
weaponx
Always trying to one up everyone else! :P Edited by weaponx

Share this post


Link to post
Share on other sites
Valuater

Good-eye, Good-eye!!!

lol

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Symplystyc

Good-eye, Good-eye!!!

lol

8)

works great, thanks :P


The glass is neither half empty nor half full, it is simply twice as big as it needs to be.

Share this post


Link to post
Share on other sites
Valuater

Welcome!

8)


NEWHeader1.png

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  

×