Create variables in a loop Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Create variables in a loop

22 Mar 2018, 07:06

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" := {}
Guest

Re: Create variables in a loop

22 Mar 2018, 07:21

Remove the space and the quotes Que%A_Index%_Status:={}
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Create variables in a loop

22 Mar 2018, 07:22

Que%A_Index%_Status := {}

Cheers.
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: Create variables in a loop

22 Mar 2018, 07:40

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
Guest

Re: Create variables in a loop

22 Mar 2018, 07:44

because you make a mistake and leave out QUE: for firstX, firstY in QueSKK_Status
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Create variables in a loop  Topic is solved

22 Mar 2018, 07:52

@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
euras
Posts: 429
Joined: 05 Nov 2015, 12:56

Re: Create variables in a loop

22 Mar 2018, 08:00

Helgef wrote:@Guest, QueSKK_Status is not defined.
You can do
Great, thanks! :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: nacken012, UncouthGoose and 120 guests