Page 1 of 1

Create variables in a loop

Posted: 22 Mar 2018, 07:06
by euras
How can I create those variables using a loop? I have tried many different options without success so far..

Code: Select all

Queues = SKG,SKS,SKP,SSV,SKK,SKB,SKA,SKU,SUP,POL,POS,REV,NSV,PUR,REW
StringSplit, Que, Queues, `,
Loop, % Que0
	Que%A_Index% "_Status" := {}

Re: Create variables in a loop

Posted: 22 Mar 2018, 07:21
by Guest
Remove the space and the quotes Que%A_Index%_Status:={}

Re: Create variables in a loop

Posted: 22 Mar 2018, 07:22
by Helgef
Que%A_Index%_Status := {}

Cheers.

Re: Create variables in a loop

Posted: 22 Mar 2018, 07:40
by euras
for some reason it doesn't work...

Code: Select all

Queues = SKG,SKS,SKP,SSV,SKK,SKB,SKA,SKU,SUP,POL,POS,REV,NSV,PUR
StringSplit, Que, Queues, `,
Loop, % Que0
	Que%A_Index%_Status := {}
SKK_Status.Push("My text")
for firstX, firstY in SKK_Status
	result .= firstY "`n"
MsgBox % result

Re: Create variables in a loop

Posted: 22 Mar 2018, 07:44
by Guest
because you make a mistake and leave out QUE: for firstX, firstY in QueSKK_Status

Re: Create variables in a loop  Topic is solved

Posted: 22 Mar 2018, 07:52
by Helgef
@Guest, QueSKK_Status is not defined.
You can do

Code: Select all

Queues = SKG,SKS,SKP,SSV,SKK,SKB,SKA,SKU,SUP,POL,POS,REV,NSV,PUR

Loop parse, % Queues, % ","
	Que%A_LoopField%_Status := {}

QueSKK_Status.Push("My text")
for firstX, firstY in QueSKK_Status
	result .= firstY "`n"
MsgBox % result

Re: Create variables in a loop

Posted: 22 Mar 2018, 08:00
by euras
Helgef wrote:@Guest, QueSKK_Status is not defined.
You can do
Great, thanks! :)