sumone4life Posted August 1, 2007 Posted August 1, 2007 I am making a bot for a website and on this website there is a list of links that are generated dynamically. Now the quantity of links changes and the location they point to changes but they all have one thing in common... they start with view.php Im looking for a way to click those links one at a time until it goes through the whole list of them. Is there a way to do that with _IE... possible use _IELinkGetCollection and then search for a text string?
PsaltyDS Posted August 1, 2007 Posted August 1, 2007 I am making a bot for a website and on this website there is a list of links that are generated dynamically. Now the quantity of links changes and the location they point to changes but they all have one thing in common... they start with view.php Im looking for a way to click those links one at a time until it goes through the whole list of them. Is there a way to do that with _IE... possible use _IELinkGetCollection and then search for a text string? Use _IELinksGetCollection(), but as soon as you click on one they will all become invalid when the browser changes pages. You have to save the links (like in an array) and click through them there. Even that may not work, because once you have navigated away from the page they came off of any java script or other stuff needed may not be available. Perhaps opening each link in a separate tab (if IE7) would help. This code gets the links, anyway: #include <IE.au3> #include <array.au3> Dim $avLinks[1] $sURL = "www.autoitscript.com" $oIE = _IECreate($sURL, 1) $colLinks = _IELinkGetCollection($oIE) ConsoleWrite("Debug: Returned " & @extended & " links." & @LF) For $oLink In $colLinks _ArrayAdd($avLinks, $oLink.href) Next $avLinks[0] = UBound($avLinks) - 1 _ArrayDisplay($avLinks, "Debug: $avLinks") Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
sumone4life Posted August 1, 2007 Author Posted August 1, 2007 Well... there are main links on the page and then an array of links generated by a php script. It doesnt use javascript for the link that im aware of. target="_blank" so it opens in a new window anyway. Really my question is... after loading the links into an array... how to i go through and remove all the ones that dont have or start with view.php?
PsaltyDS Posted August 1, 2007 Posted August 1, 2007 Well... there are main links on the page and then an array of links generated by a php script. It doesnt use javascript for the link that im aware of. target="_blank" so it opens in a new window anyway. Really my question is... after loading the links into an array... how to i go through and remove all the ones that dont have or start with view.php? Is that part of the href string that is in the array generated by my previous post? If so, then it's just a tweak to the loop: For $oLink In $colLinks $sHref = $oLink.href If StringInStr($sHref, "view.php") Then _ArrayAdd($avLinks, $sHref) Next Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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