anhchangtk Posted April 19, 2009 Share Posted April 19, 2009 Now, I do making 1 tool search from google, I had use _IELinkGetCollection to get all results find out. And don't want collect links "http://google.com" And how do Filter 1 or manay link don't needEX: I don't need collection 4 link:http://www.google.com/intl/vi/help.htmlhttp://www.google.com/intl/vi/ads/http://www.google.com/services/http://www.google.com/intl/vi/about.htmlAnd my code:#include <IE.au3> $oIE = _IECreate("http://www.google.com/search?hl=en&q=Cry+On+My+Shoulder&btnG=Google+Search&aq=f&oq=") $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended For $oLink In $oLinks Msgbox(0,"Link Collection",$oLink.href) NextThanks you has view my post Link to comment Share on other sites More sharing options...
DaleHohm Posted April 19, 2009 Share Posted April 19, 2009 One thing you can do is scope the search within the page to the area that contains the results. These are in a DIV section with an id of "res" (easily learned using DebugBar). You can then get all of the "a" tags within that section (_IELinkGetCollection always works on the entire document. E.g.: #include <IE.au3> $oIE = _IECreate("http://www.google.com/search?hl=en&q=Cry+On+My+Shoulder&btnG=Google+Search&aq=f&oq=") $oDiv = _IEGetObjById($oIE, "res") $oLinks = _IETagnameGetCollection($oDiv, "a") You'll find these links to be much more what you want. Beyond that you'll need to loop through the links and examine each one. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
anhchangtk Posted April 19, 2009 Author Share Posted April 19, 2009 Thanks you But i don't understand: Why use "res" and "a" in _IEGetObjById and _IETagnameGetCollection mean 2 this word? Link to comment Share on other sites More sharing options...
DaleHohm Posted April 19, 2009 Share Posted April 19, 2009 I don't understand what you don't understand. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
anhchangtk Posted April 20, 2009 Author Share Posted April 20, 2009 Why you use the below code:$oDiv = _IEGetObjById($oIE, "res")$oLinks = _IETagnameGetCollection($oDiv, "a")I don't understand:Why in "res" and "a"What it mean ???Can me replace other words? Link to comment Share on other sites More sharing options...
Authenticity Posted April 20, 2009 Share Posted April 20, 2009 res is the ID of the div element in that page which must be unique. By getting an object reference to it and using it in the _IETagnameGetCollection() you're limiting the scope of the function to search for <a> tags just within this element and not the entire page if you called it like this, for example: $oLinks = _IETagnameGetCollection($oIE, 'a') a if for <a> tags. Link to comment Share on other sites More sharing options...
anhchangtk Posted April 20, 2009 Author Share Posted April 20, 2009 Thanks you very much I has understand Link to comment Share on other sites More sharing options...
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