Code: Select all
Tree_Array[oKey]:= {mylocationis: vAccLocation, mynameis: vName, mykey: oKey}
Code: Select all
Tree_Array[oKey]:= {mylocationis: vAccLocation, mynameis: vName, mykey: oKey}
Code: Select all
#NoEnv
;~ Tree_Array[oKey]:= {mylocationis: vAccLocation, mynameis: vName, mykey: oKey}
Tree_Array:= {"mylocationis": ["vAccLocation", "sss", "www"], "mynameis": ["vName", "qqq"], "mykey": ["oKey", "rrr"]}
for subArr, Arr in Tree_Array
for j in Arr
MsgBox % SubArr " > " Tree_Array[SubArr][j]
esc::ExitApp
rommmcek wrote:I'm certainly no expert in Arrays, but your assignement seems to be wrong. Try:Code: Select all
#NoEnv ;~ Tree_Array[oKey]:= {mylocationis: vAccLocation, mynameis: vName, mykey: oKey} Tree_Array:= {"mylocationis": ["vAccLocation", "sss", "www"], "mynameis": ["vName", "qqq"], "mykey": ["oKey", "rrr"]} for subArr, Arr in Tree_Array for j in Arr MsgBox % SubArr " > " Tree_Array[SubArr][j] esc::ExitApp
Code: Select all
if IsObject(Tree_Array)
MsgBox Assignement is O.K.
else MsgBox Assignement seems to be false
Code: Select all
Tree_Array := {} ; create an assoc. array
Tree_Array[111]:= {mylocationis: "Paris", mynameis: "Jim", mykey: oKey}
Tree_Array[222]:= {mylocationis: "Berlin", mynameis: "Tim", mykey: oKey}
Tree_Array[333]:= {mylocationis: "Madrid", mynameis: "Tom", mykey: oKey}
for key, Arr in Tree_Array
{
If (Arr.mynameis = "Tom")
msgbox % "Key: " key "`nTom's location: " Arr.mylocationis
else
msgbox % "Key: " key " " Arr.mynameis "`nNo, it's not Tom!"
}
ExitApp
esc::ExitApp
Code: Select all
Tree_Array[oKey]:= {mylocationis: vAccLocation, mynameis: vName, mykey: oKey}
for each, Entry in Tree_Array, Result := []
if (Entry.mynameis == "your_name_lookup")
Result.Push(Entry)
for each, Entry in Result
MsgBox % Entry.mylocationis
Afaik, if you are using the [ ] syntax for assigning, you need the associative array to be created before via { } or Object(): https://autohotkey.com/docs/Objects.htm ... ive_Arraysrommmcek wrote:I might be wrong but:doesn't give good result for your assignement.Code: Select all
if IsObject(Tree_Array) MsgBox Assignement is O.K. else MsgBox Assignement seems to be false
Code: Select all
Tree_Array := {} ; create an assoc. array
; obviously, usually you would fill the variables somewhere here
Tree_Array[oKey]:= {mylocationis: vAccLocation, mynameis: vName, mykey: oKey}
if IsObject(Tree_Array)
MsgBox Assignement is O.K.
else MsgBox Assignement seems to be false
nothing wrong with it as far as i can tellgregster wrote:I think, there is a rogue/misplaced , Result := [] in your code, swagfag.
Oh yeah, I really didn't know that this was allowed on the same line with a for-loop. Sorry...swagfag wrote:nothing wrong with it as far as i can tellgregster wrote:I think, there is a rogue/misplaced , Result := [] in your code, swagfag.
Code: Select all
Tree_Array2:={}
Tree_Array2[oKey,0]:=vAccLocation ; these are in a loop somewhere
Tree_Array2[oKey,1]:=vName ; these are in a loop somewhere
Code: Select all
For Each, Row in Tree_array2
For, Each, item in Row
MsgBox %item%
Code: Select all
test:="sss"
i:=0
j:=0
For each, Row in Tree_array2
{ i:=i+1
j:=0
For each , item in Row
{
test:=Tree_Array2[i,j]
if test:="John"
MsgBox found
MsgBox %i% . " " . %j%
j :=j+1
}
}
Code: Select all
if test:="John"
MsgBox found
Code: Select all
if (test="John")
MsgBox found
Users browsing this forum: Bing [Bot], Google [Bot], typerd92 and 111 guests