Jump to content

How to access a single Link that has been corraled....


tommytx
 Share

Recommended Posts

I have one single link pinned down in the last part of the program and I cannot figure out how to get access to it. Can someone help?

; This section works just fine and finds 201 links

; **************************************************

Local $oLinks = _IELinkGetCollection($oIE)

Local $iNumLinks = @extended

MsgBox(0, "Link Info", $iNumLinks & " links found"); Says links found 201

; This section works just fine and finds 1 link

; ***********************************************

Local $oDiv = _IEGetObjById($oLinks, "an1")

Local $iNumLinks = @extended

MsgBox(0, "Link Info", $iNumLinks & " links found") ; Says 1 link found

; Need to know how to address the one link I have found..

; Tried all the stuff below but nothing works.

;ConsoleWrite($oDiv.$oLinks.href)

;ConsoleWrite($oLinks.$oDiv.href)

;ConsoleWrite($oDiv.href)

Just for info... the id=an1 above is the location that has the one single link that I need to be able to access... the other 200 have been eliminated.

If anyone wonders or even cares why the code is not in the code box, it no longer allows me to use the code box... anyone know what the problem is.. maybe when I reboot it will be ok for future posts.

Thanks for any suggestions.

Edited by tommytx
Link to comment
Share on other sites

Example

The Link of your Profile present at the first post in your profile name would be returned in the MsgBox

Note that this example will not work if user would not have logged into his account

#include <IE.au3>

$sID = "anonymous_element_2"
$sLink = "http://www.autoitscript.com/forum/topic/148651-how-to-access-a-single-link-that-has-been-corraled/"

_IEErrorHandlerRegister()
$oIE = _IECreate( $sLink )
If @error Then Exit -1
$oLink = _IEGetObjById( $oIE, $sID )
If @error Then Exit -2

MsgBox( 64, "Href:", $oLink.Href )

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Sorry but that went right over my head. The example of pulling my profile URL from the forum did not ring a bell in regard to what I am doing.. sorry.. its probably in there but I just can't pull it out...

Maybe I did not explain what I am trying to do clearly enough.

**************************************************************

Part 1 I scanned the entire page for links and found 201 and I don't want all 200, I just want all the ones located in the id=an1.

Local $oLinks = _IELinkGetCollection($oIE)

Local $iNumLinks = @extended

MsgBox(0, "Link Info", $iNumLinks & " links found"); Says 201 links found

Next I scanned the links that I thought I had corralled in the an1 id section.

and I believe by the report below its saying that id=an1 has a total of 1 of the 201 links. Now how do I access the one link that I have isolated.. are am I totally lost.....

; This section works just fine and finds 1 link

; ***********************************************

Local $oDiv = _IEGetObjById($oLinks, "an1")

Local $iNumLinks = @extended

MsgBox(0, "Link Info", $iNumLinks & " links found") ; Says 1 link found

How to print the single link....

Edited by tommytx
Link to comment
Share on other sites

I believe the there is only one link having the id an1

Hence you could supply _IEGetObjById the browser object and retrieve the element

Something like this should help

_IEErrorHandlerRegister() ;to check for errors
$oIE = _IECreate( "your website address" )
$oLink = _IEGetObjById( $oIE, "an1" ) ;get the element having ID an1

;Show its Href property
MsgBox( 64, "Href:", $oLink.Href )

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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