ThomasQ Posted March 28, 2010 Share Posted March 28, 2010 Hi! I'm extremely emberassed by my n00bness, but since I started using Autoit 6 months ago, I still got to a halt, when trying to use Collection Objects. How do I count the number of Item's collected? And is there any way of looking in the collection object? Many Thanks in advance Thomas Link to comment Share on other sites More sharing options...
Yoriz Posted March 29, 2010 Share Posted March 29, 2010 Do you mean like this using .count() ? $Dict1 = ObjCreate("Scripting.Dictionary") With $Dict1 .Add ( "Item 1","10") .Add ("Item 2","20") .Add ("Item 3","30") EndWith MsgBox(0,"object.count",$Dict1.count()) GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF. Link to comment Share on other sites More sharing options...
ThomasQ Posted April 20, 2010 Author Share Posted April 20, 2010 Hi! Just got back from vacation, and started on my script again. But no, I meant an Collection object, like the one you get with the _IETableGetCollection function. Thanks in advance! Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 20, 2010 Share Posted April 20, 2010 (edited) When you run _IETableGetCollection() the count is returned in @extended. See the help file. You might also get the count in a .length property, but I can't test to be sure right now. Edit: Back in Windows land, verified .length works: #include <IE.au3> $oIE = _IE_Example ("table") $oTables = _IETableGetCollection ($oIE) $iExtSav = @extended $iLength = $oTables.length MsgBox(64, "Test", "@extended = " & $iExtSav & "; .length = " & $iLength) That's actually how the UDF gets it for @extended, though you have to look inside the call a little to see it: Return SetError($_IEStatus_Success, $o_object.document.GetElementsByTagName("table" ).length,$o_object.document.GetElementsByTagName("table")) Edited April 20, 2010 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...
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