Jump to content

Need Help with _IELinkGetCollection


Recommended Posts

How do I go about retrieving an output/display list of indexes collected by _IELinkGetCollection?  The code below shows that 41 links are found, but I am unable to display the link collection at Google.com.  What method(s) may I use to see the collection of links by indexes?

#include <IE.au3>

Local $oIE = _IECreate("http://www.google.com")
_IELoadWait($oIE) ;Wait for the IE object to finish loading.
$oHWND = _IEPropertyGet($oIE, "hwnd") ;Return the selected IE object property selected: "hwnd".
WinMove($oHWND, "", 0, 0) ;Move the IE handle returned by IEPropertyGet to x0, y0 coordinate.
_SetMaximize() ;Maximize the screen if it is not.

_IELinkGetCollection($oIE)
Local $oLinks = _IELinkGetCollection($oIE, 0)
Local $iNumLinks = @extended
Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
;_IELinkClickByIndex($oIE, 14)
Msgbox(0,"",$sTxt)

Func _SetMaximize()
    $WinState = WinGetState($oHWND) ;Get the state of the IE object.
    If $WinState <> @SW_MAXIMIZE Then ;If the windows state is not maximize then
        WinSetState($oHWND, "", @SW_MAXIMIZE) ;set the state to maximize.
    Else ;otherwise
        Sleep(10)
    EndIf
EndFunc   ;==>_SetMax

 

Link to comment
Share on other sites

Found a post on the forum with similar request and am testing to see if I can use it for my purpose.

#include <AutoItConstants.au3>
#include <IE.au3>
#include <Array.au3>

Local $oIEBasic = _IE_Example("basic")

Local $oAllWebsiteLinks = _IELinkGetCollection($oIEBAsic)
Local $aLinkPaths[@extended]
Local $i = 0

For $oSingleLink In $oAllWebsiteLinks
     $aLinkPaths[$i] = _IEPropertyGet($oSingleLink, "innertext")
     $i = $i + 1
Next

_IEQuit ($oIEBasic)

_ArrayDisplay($aLinkPaths)

 

Link to comment
Share on other sites

This works for me.

#include <IE.au3>
#include <Array.au3>

Local $oIE = _IECreate("http://www.google.com")
_IELoadWait($oIE) ;Wait for the IE object to finish loading.
$oHWND = _IEPropertyGet($oIE, "hwnd") ;Return the selected IE object property selected: "hwnd".
WinMove($oHWND, "", 0, 0) ;Move the IE handle returned by IEPropertyGet to x0, y0 coordinate.
_SetMaximize() ;Maximize the screen if it is not.

_IELinkGetCollection($oIE)
Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
Local $aLinks[0]
For $oLink in $oLinks
    _ArrayAdd($aLinks,$oLink.href)
Next
_ArrayDisplay($aLinks,$sTxt)


Func _SetMaximize()
    $WinState = WinGetState($oHWND) ;Get the state of the IE object.
    If $WinState <> @SW_MAXIMIZE Then ;If the windows state is not maximize then
        WinSetState($oHWND, "", @SW_MAXIMIZE) ;set the state to maximize.
    Else ;otherwise
        Sleep(10)
    EndIf
EndFunc   ;==>_SetMax

Saludos

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