- Prompted by this link:
Identify different types of associative arrays - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 62#p201862
- Btw for SafeArrays:
ComObjArray()
https://autohotkey.com/docs/commands/ComObjArray.htm
Code: Select all
; Get the number of dimensions:
dim := DllCall("oleaut32\SafeArrayGetDim", "ptr", ComObjValue(arr))
Code: Select all
q:: ;object get dimensions
oArray1 := []
oArray2 := [[]]
oArray3 := [[[]]]
oArray4 := [[[[]]]]
MsgBox, % ObjGetDim(oArray1)
MsgBox, % ObjGetDim(oArray2)
MsgBox, % ObjGetDim(oArray3)
MsgBox, % ObjGetDim(oArray4)
return
ObjGetDim(ByRef oArray)
{
if !IsObject(oArray)
return 0
oTemp := {(&oArray):1}
vDimMax := 1
Loop
{
if !oTemp.Length()
break
pArray := oTemp.Length()
vDim := oTemp.Pop()
if (vDim > vDimMax)
vDimMax := vDim
oArray2 := Object(pArray)
for vKey, vValue in oArray2
if IsObject(vValue)
oTemp[&vValue] := vDim+1
}
return vDimMax
}