MrUdinov Posted January 10, 2020 Share Posted January 10, 2020 hi I want to get Link with same class and put in array, the click on the link i use this code but this just click on link 0 in array ; Get a reference to the collection of forms on a page, ; and then loop through them displaying information for each ; demonstrating use of form index #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("http://hiva.site") ; $oFound = "" Global $oFound [10] $colLinks = _IELinkGetCollection($oIE) For $oLink In $colLinks For $Count=0 to 9 If $oLink.className & "" = "movie-poster col-xs-3 no-padding" Then $oFound ["Count"] = $oLink EndIf Next Next _IEAction ($oFound [1], "click") Link to comment Share on other sites More sharing options...
MrUdinov Posted January 10, 2020 Author Share Posted January 10, 2020 just When i use _IEAction ($oFound [0], "click") this work Link to comment Share on other sites More sharing options...
Nine Posted January 10, 2020 Share Posted January 10, 2020 (edited) Should be : For $Count=0 to 9 If $oLink.className & "" = "movie-poster col-xs-3 no-padding" Then $oFound [$Count] = $oLink EndIf Next The way you wrote it, "Count" is converted to 0. But I do not understand why you would put 10 times the same exact object in the array. Maybe this is what you meant to write ? #include <IE.au3> Local $oIE = _IECreate("http://hiva.site") Local $oFound [10], $Count = 0 Local $colLinks = _IELinkGetCollection($oIE) For $oLink In $colLinks If $oLink.className = "movie-poster col-xs-3 no-padding" Then $oFound [$Count] = $oLink $Count += 1 If $Count = UBound($oFound) Then ExitLoop EndIf Next _IEAction ($oFound [1], "click") Edited January 10, 2020 by Nine MrUdinov 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
MrUdinov Posted January 10, 2020 Author Share Posted January 10, 2020 35 minutes ago, Nine said: Should be : For $Count=0 to 9 If $oLink.className & "" = "movie-poster col-xs-3 no-padding" Then $oFound [$Count] = $oLink EndIf Next The way you wrote it, "Count" is converted to 0. But I do not understand why you would put 10 times the same exact object in the array. Maybe this is what you meant to write ? #include <IE.au3> Local $oIE = _IECreate("http://hiva.site") Local $oFound [10], $Count = 0 Local $colLinks = _IELinkGetCollection($oIE) For $oLink In $colLinks If $oLink.className = "movie-poster col-xs-3 no-padding" Then $oFound [$Count] = $oLink $Count += 1 If $Count = UBound($oFound) Then ExitLoop EndIf Next _IEAction ($oFound [1], "click") Thank you , it worked. if i need to count the element that have class( movie-poster col-xs-3 no-padding ) , what Sohuld I do? Link to comment Share on other sites More sharing options...
Nine Posted January 10, 2020 Share Posted January 10, 2020 (edited) It is there. $Count += 1 already doing it but it is stopping at 10 elements since the array is bound to 10, you can increase the number of elements if you wish to. Add MsgBox (0,"",$Count) after loop to know how many links were found. Edited January 10, 2020 by Nine MrUdinov 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
MrUdinov Posted January 10, 2020 Author Share Posted January 10, 2020 1 hour ago, Nine said: It is there. $Count += 1 already doing it but it is stopping at 10 elements since the array is bound to 10, you can increase the number of elements if you wish to. Add MsgBox (0,"",$Count) after loop to know how many links were found. thank you , when there is no link , just java script click , what i should to do for auto click? Link to comment Share on other sites More sharing options...
MrUdinov Posted January 10, 2020 Author Share Posted January 10, 2020 1 hour ago, Nine said: It is there. $Count += 1 already doing it but it is stopping at 10 elements since the array is bound to 10, you can increase the number of elements if you wish to. Add MsgBox (0,"",$Count) after loop to know how many links were found. when i increase number, the loop doesn't stop until it is run as number If $Count = UBound($oFound) Then ExitLoop Link to comment Share on other sites More sharing options...
MrUdinov Posted January 10, 2020 Author Share Posted January 10, 2020 1 hour ago, MrUdinov said: when i increase number, the loop doesn't stop until it is run as number If $Count = UBound($oFound) Then ExitLoop i test this an it is work Link to comment Share on other sites More sharing options...
Subz Posted January 10, 2020 Share Posted January 10, 2020 Here is a way which will build a dynamic list of addresses and then open each address in a new tab (wasn't sure if you wanted to print this list or open each item). #include <Array.au3> #include <IE.au3> Const $navOpenInNewTab = 0x0800 Local $oIE = _IECreate("https://hiva.site/", 1) Sleep(3000) Global $aLinks[0] Global $oLinks = _IELinkGetCollection($oIE) If IsObj($oLinks) Then For $i = 0 To $oLinks.length - 1 If $oLinks($i).className = "movie-poster col-xs-3 no-padding" Then ReDim $aLinks[UBound($aLinks) + 1] ;~ Expand $aLinks Array $aLinks[UBound($aLinks) - 1] = $oLinks($i).href EndIf Next EndIf _ArrayDisplay($aLinks) For $i = 0 To UBound($aLinks) - 1 $oIE.Navigate2($aLinks[$i], $navOpenInNewTab) Next MrUdinov 1 Link to comment Share on other sites More sharing options...
MrUdinov Posted January 11, 2020 Author Share Posted January 11, 2020 10 hours ago, Subz said: Here is a way which will build a dynamic list of addresses and then open each address in a new tab (wasn't sure if you wanted to print this list or open each item). #include <Array.au3> #include <IE.au3> Const $navOpenInNewTab = 0x0800 Local $oIE = _IECreate("https://hiva.site/", 1) Sleep(3000) Global $aLinks[0] Global $oLinks = _IELinkGetCollection($oIE) If IsObj($oLinks) Then For $i = 0 To $oLinks.length - 1 If $oLinks($i).className = "movie-poster col-xs-3 no-padding" Then ReDim $aLinks[UBound($aLinks) + 1] ;~ Expand $aLinks Array $aLinks[UBound($aLinks) - 1] = $oLinks($i).href EndIf Next EndIf _ArrayDisplay($aLinks) For $i = 0 To UBound($aLinks) - 1 $oIE.Navigate2($aLinks[$i], $navOpenInNewTab) Next Thank you , when there is no link , just java script click , what i should to do for auto click? Link to comment Share on other sites More sharing options...
Nine Posted January 11, 2020 Share Posted January 11, 2020 Could you show us the DOM that involves the java script ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts