rudi Posted April 2, 2008 Share Posted April 2, 2008 Hi, changing the help script for IELinkGetCollection() I already figured out how to download all the MP3 files of the "Betthupferl" from Bayern 1, a Bavarian Radio Station. (The kids love these 5 minute stories and always the final 120 are available for download. Works fine ) But honestly, I do not really understand what I used there. First I thought that a "Collection" is an array and tried to figure out it's dimension. But it seems to be some special data type? The Sample Code gives this: #include <IE.au3> $oIE = _IE_Example ("basic") $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks MsgBox(0, "Link Info", $oLink.href) Next Is this a data type with "subelements" addressed with ".href" and other suffixes? Where to find a list of all valid subfixes? How to check for all information stored in such a collection? Who can pls point me towards the documentation covering that? Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
DaleHohm Posted April 2, 2008 Share Posted April 2, 2008 Array/Collection question asked and answered many times. Look here for one: http://www.autoitscript.com/forum/index.ph...st&p=291414For properties like .href, see MSDN (in my sig).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...
rudi Posted April 3, 2008 Author Share Posted April 3, 2008 Hello.Array/Collection question asked and answered many times. Look here for one: http://www.autoitscript.com/forum/index.ph...st&p=291414For properties like .href, see MSDN (in my sig).DaleThat's not what I wanted to understand Your MSDN Link brought me e.g. to this page:http://samples.msdn.microsoft.com/workshop...iew/elem_01.htmwich is listing all the collection content. Is there something simmilar for Autoit3? Something like _ArrayDisplay could be something like _CollectionDisplay()...If such a function exists, I missed it, sorry!Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
DaleHohm Posted April 3, 2008 Share Posted April 3, 2008 That's not what I wanted to understand I don't know what you meanYour MSDN Link brought me e.g. to this page:http://samples.msdn.microsoft.com/workshop...iew/elem_01.htmwich is listing all the collection content. Is there something simmilar for Autoit3? Something like _ArrayDisplay could be something like _CollectionDisplay()...If such a function exists, I missed it, sorry!The example you cite can easily be implemented in AutoIt with a For... In... Next loop.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...
rudi Posted April 4, 2008 Author Share Posted April 4, 2008 (edited) Hi. The example you cite can easily be implemented in AutoIt with a For... In... Next loop. "easily" ... ... not for me at least not up to now Well, the code doing the work is that one, right? <script LANGUAGE="Javascript"> function showElements() { var tag_names = "This document contains:\n"; for (i=0; i<document.all.length; i++) tag_names += document.all(i).tagName + "\n"; alert(tag_names); } </SCRIPT> No clue at all how to step through the content of a "collection" variable filled like this #include <ie.au3> #include <array.au3> #include <constants.au3> const $DLdir="Q:\home\Betthupferl\download\" dim $myArray[1] $result=_IECreate("http://www.br-online.de/podcast/mp3-download/bayern1/mp3-download-podcast-betthupferl.shtml") $oLinks = _IELinkGetCollection ($result) $iNumLinks = @extended For $oLink In $oLinks _ArrayAdd($myArray,$oLink.href) Next _IEQuit($result) e.g. I'd like to figure out what other extensions beside ".href" are valid... Basically I obviously didn't get yet the structure of a "collection" Regards, Rudi. Edited April 4, 2008 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
zorphnog Posted April 4, 2008 Share Posted April 4, 2008 e.g. I'd like to figure out what other extensions beside ".href" are valid...Basically I obviously didn't get yet the structure of a "collection" You have to realize that by using _IELinkGetCollection you are only receiving a collection of links on the page. In other words, you are receiving a collection of only the objects that appear as <a href="..."></a> in the html document. To really understand this, you need to become familiar with th DOM (Document Object Model) for html. In answer to your question though, I think this link has the properties that you are looking for:http://msdn2.microsoft.com/en-us/library/m...185(VS.85).aspxNot every object returned in the collection will have all of these properties, but these are the possible properties it could have. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 4, 2008 Share Posted April 4, 2008 Hi. "easily" ... ... not for me at least not up to now Well, the code doing the work is that one, right? <script LANGUAGE="Javascript"> function showElements() { var tag_names = "This document contains:\n"; for (i=0; i<document.all.length; i++) tag_names += document.all(i).tagName + "\n"; alert(tag_names); } </SCRIPT> No clue at all how to step through the content of a "collection" variable filled like this #include <ie.au3> #include <array.au3> #include <constants.au3> const $DLdir="Q:\home\Betthupferl\download\" dim $myArray[1] $result=_IECreate("http://www.br-online.de/podcast/mp3-download/bayern1/mp3-download-podcast-betthupferl.shtml") $oLinks = _IELinkGetCollection ($result) $iNumLinks = @extended For $oLink In $oLinks _ArrayAdd($myArray,$oLink.href) Next _IEQuit($result) e.g. I'd like to figure out what other extensions beside ".href" are valid... Basically I obviously didn't get yet the structure of a "collection" Regards, Rudi. Your question actually has nothing to do with collections. .href property is attached to the $oLink object, not the collection. Use the MSDN links in Dale's sig to learn more about Link Objects in the IE DOM, and you'll find the other properties. There are other methods and properties that ARE attached to a collection, such as .count (how many objects in the collection), so instead of setting $iNumLinks = @extended, you could do $iNumLinks = $oLinks.count. But a collection is a collection of other objects. The .href property is associated with one of $oLink objects inside the collection, not the collection itself. Think of a bookcase with books in it. "Walnut stain" is a property of the bookcase, not the books. "Number of pages" is a property of one of the books, not of the bookcase. It wouldn't make sense to ask "How many pages is that bookcase?" for same reason it doesn't make sense to ask "What's the .href link of that collection?". 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 Link to comment Share on other sites More sharing options...
rudi Posted April 8, 2008 Author Share Posted April 8, 2008 Instead of setting $iNumLinks = @extended, you could do $iNumLinks = $oLinks.count.Ahhh, very interesting...But a collection is a collection of other objects.ACKThe .href property is associated with one of $oLink objects inside the collection, not the collection itself.Hm. So $oLink is already an object inside a collection? What collection? I mean: What's the collection's name oLink is a part of? Is $oLink a "collection inside a collection"? <confused>Think of a bookcase with books in it. "Walnut stain" is a property of the bookcase, not the books. "Number of pages" is a property of one of the books, not of the bookcase. It wouldn't make sense to ask "How many pages is that bookcase?" for same reason it doesn't make sense to ask "What's the .href link of that collection?".ACK. But it might be making sense to ask: How many books are in this bookstore and what are their titles for something likebookstore with bookstore.bookshelf bookstore.bookshelf.book bookstore.bookshelf.book.titleand to ask for what other things do exist inside bookstore? bookstore.counter, bookstore.washroom bookstore.stairs ...I have never worked with such collections before, but I assume such a collection can end up in a rich ramificated tree structure, and how to "view" that one, that's what I don't know up to now...Thanks.Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 8, 2008 Share Posted April 8, 2008 (edited) Hm. So $oLink is already an object inside a collection? What collection? I mean: What's the collection's name $oLink is a part of? Is $oLink a "collection inside a collection"? <confused>The collection is $oLinks. The $oLinks collection contains objects. The For/In/Next loop pulls the objects out of the collection one at a time as $oLink. ACK. But it might be making sense to ask: How many books are in this bookstore and what are their titles for something like bookstore with bookstore.bookshelf bookstore.bookshelf.book bookstore.bookshelf.book.title and to ask for what other things do exist inside bookstore? bookstore.counter, bookstore.washroom bookstore.stairs... The "bookstore" parent object was not part of my analogy, and is not required. Don't make it unnecessarily complicated. I mentioned a a bookcase, say it's $oBookcase, which is a collection of book objects. If I pull those books out one at a time to look at them, it would be like a For/In/Next loop (I'll throw the Bookstore back in just for giggles).; Access the bookstore $oBookstore = _BookstoreAttach("Barnes&Noble") MsgBox(64, "Address", "Bookstore at: " & $oBookstore.StreetAddress) ; Get the collection of bookcases $oBookcases = _GetBookcaseObjCollection($oBookstore) MsgBox(64, "Count", "There are " & $oBookcases.count & " bookcases in this store.") ; Loop through all the individual bookcases in that collection For $oBookcase In $oBookcases MsgBox(64, "Section", "This bookcase contains: " & $oBookcase.Genre) ; i.e. "Fiction" or "Travel" ; Get the collection of books in this bookcase $oBooks = _GetBookObjCollection($oBookcase) MsgBox(64, "Inventory", "There are " & $oBooks.count & " books in this bookcase.") ; Loop through all the individual books in that collection For $oBook In $oBooks MsgBox(64, "Book: " & $oBook.Title, "Author = " & $oBook.Title) Next Next I have never worked with such collections before, ...No one has, until they do. ...but I assume such a collection can end up in a rich ramificated tree structure, and how to "view" that one, that's what I don't know up to now... Thanks. Regards, Rudi."Ramificated" is not a word. This analogy has been stretched far enough... Edited April 8, 2008 by PsaltyDS 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 Link to comment Share on other sites More sharing options...
rudi Posted April 8, 2008 Author Share Posted April 8, 2008 Thanks for this nice example: ; Access the bookstore $oBookstore = _BookstoreAttach("Barnes&Noble") MsgBox(64, "Address", "Bookstore at: " & $oBookstore.StreetAddress) ; Get the collection of bookcases $oBookcases = _GetBookcaseObjCollection($oBookstore) MsgBox(64, "Count", "There are " & $oBookcases.count & " bookcases in this store.") ; Loop through all the individual bookcases in that collection For $oBookcase In $oBookcases MsgBox(64, "Section", "This bookcase contains: " & $oBookcase.Genre) ; i.e. "Fiction" or "Travel" ; Get the collection of books in this bookcase $oBooks = _GetBookObjCollection($oBookcase) MsgBox(64, "Inventory", "There are " & $oBooks.count & " books in this bookcase.") ; Loop through all the individual books in that collection For $oBook In $oBooks MsgBox(64, "Book: " & $oBook.Title, "Author = " & $oBook.Title) Next Next No one has, until they do.I'm on my way "Ramificated" is not a word. ... now it is: I just DID write it Thanks for your help, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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