Array/object wishlist (count, printarr, contains, other).

Propose new features and changes
treashunter

Re: Array/object wishlist (count, printarr, contains, other).

11 Feb 2016, 14:16

Geekdudes Array_gui() function has proven very useful to me. I say +1 for a built in printarr function :)

http://imgur.com/5Cz1sOh
User avatar
bichlepa
Posts: 155
Joined: 15 Aug 2014, 06:44
GitHub: bichlepa
Contact:

Re: Array/object wishlist (count, printarr, contains, other).

25 Feb 2016, 09:57

+1 for Obj.Count()
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.
User avatar
kczx3
Posts: 640
Joined: 06 Oct 2015, 21:39

Re: Array/object wishlist (count, printarr, contains, other).

11 Apr 2016, 11:15

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))
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?
Qriist
Posts: 12
Joined: 11 Sep 2016, 04:02

Re: Array/object wishlist (count, printarr, contains, other).

11 Feb 2018, 20:15

I second this motion, especially to use variables in array levels.


Also, per tidbit, BUMP.
User avatar
Flipeador
Posts: 1018
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Array/object wishlist (count, printarr, contains, other).

07 Apr 2018, 18:30

⠀⠀⠀⠀ItemCount := Object.Count() / ObjCount(Object)
Counts the number of items in an array/object.
+1 here too! :)
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2 My GDI+ Library

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 5 guests