Dynamicly created arrays

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Dynamicly created arrays

17 Apr 2016, 18:08

Global Malzemelerx := Object()

Code: Select all

MalzemeListesi := ["eldiven", "seffafeldiven", "enjektor", "abeslang", "bobrekkuveti", "branul", "serumseti", "gazlibez", "insulinenjektoru", "sutureip", "jetokain", "bisturi", "alcipamugu", "alcisargi", "dikloron", "muscoril", "ulcuran"]

Loop % MalzemeListesi.Length()
{
 IniRead, outmalzeme, %A_AppData%\Malzemeler.ini, % MalzemeListesi[A_Index]
 StringSplit, F, outmalzeme, =
 Malzemelerx.Insert := {MalzemeListesi[A_Index]: [F1, F2]}
}
MsgBox % Malzemelerx.eldiven[1] ; empty

Want to create Malzemelerx array dynamicly.
Like this;

Malzemelerx.Insert{eldiven: ["ELDİVEN NON STERIL", "VAR"]}

In the loop the other one goes like;

Malzemelerx.Insert{seffafeldiven: ["SEFFAF ELDİVEN STERIL", "VAR"]}

Thank you. :thumbup:
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Dynamicly created arrays

17 Apr 2016, 19:32

Try this:

Code: Select all

Loop % MalzemeListesi.Length()
{
    IniRead, outmalzeme, %A_AppData%\Malzemeler.ini, % MalzemeListesi[A_Index]
    Index := A_Index
    Loop, Parse, outmalzeme, `n, `r
    {
        StringSplit, F, A_LoopField, =
        Malzemelerx[MalzemeListesi[Index]] := [F1, F2]
    }
}
I hope that helps.
murataygun
Posts: 104
Joined: 07 Aug 2015, 15:53

Re: Dynamicly created arrays

17 Apr 2016, 23:02

Thank you very much.

I also can acces it like this;

MsgBox % Malzemelerx[MalzemeListesi[A_Index]][1]

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Chunjee, Hansielein, Lpanatt and 330 guests