LisHawj Posted June 25, 2018 Posted June 25, 2018 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
LisHawj Posted June 25, 2018 Author Posted June 25, 2018 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)
Danyfirex Posted June 25, 2018 Posted June 25, 2018 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 LisHawj 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now