Geekdudes Array_gui() function has proven very useful to me. I say +1 for a built in printarr function
http://imgur.com/5Cz1sOh
Array/object wishlist (count, printarr, contains, other).
Re: Array/object wishlist (count, printarr, contains, other).
+1 for Obj.Count()
In the meantime I'll use this:
In the meantime I'll use this:
Code: Select all
class ObjectWithCounter
{
count()
{
return NumGet(&this + 4*A_PtrSize)
}
}
MyObject:=new ObjectWithCounter()
MyObject.push("a")
MyObject.push("b")
msgbox, % MyObject.count()
Scripting is too complicated? Try AutoHotFlow, the graphical automation tool! Written in AutoHotkey.
Re: Array/object wishlist (count, printarr, contains, other).
I too have had this incident come about time and time again. But today I was reading through this and if I interpret it correctly, it would do what we want, no?tidbit wrote:ran into this need for .key a couple times lately:
Due to the Objects auto-ABC sort, I need to turn 1D arrays into 2D arrays.
Each sub-array only consists of 1 array/object.
Usage: I have a treeview and a listbox. I can add items from the treeview to the listbox, when added to the LB, add to an object aswell. Something like: {TV_ID : TV_TEXT}. But since I want it in the order of which it's added to the LB (incase I need to rebuild the LB, if I delete an item), I need to make it a 2D Array, to avoid auto-sorting.
Code: Select all
arr:=[{"437742":"first"},{"122516":"second"},{"472125":"third"}] ; instead of this for every part I go through the array (this gets messier when other {}'s are needed for the for-loops): for key, arr2 in arr for key, val in arr2 msgBox, %key% = %val% ; it'd simply be: for key, arr2 in arr msgBox, % arr2.key(1) " = " arr2.value(1) ; or if I only need the 3rd item from the list msgbox % arr[3].key(1 " = " arr[3].value(1))
Re: Array/object wishlist (count, printarr, contains, other).
I second this motion, especially to use variables in array levels.
Also, per tidbit, BUMP.
Also, per tidbit, BUMP.
Re: Array/object wishlist (count, printarr, contains, other).
+1 for Obj.Count()
Re: Array/object wishlist (count, printarr, contains, other).
+1 here too!⠀⠀⠀⠀ItemCount := Object.Count() / ObjCount(Object)
Counts the number of items in an array/object.
Who is online
Users browsing this forum: No registered users and 57 guests