Split List into separate strings Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

Split List into separate strings

Post by HiSoKa » 29 Nov 2022, 10:21

Hello,
I have this code, it works fine.

Code: Select all

List =
(
Section = 1
Section = 2
Section = 3
Section = 4
Section = 5
Section = 7
)

Loop, Parse, List, `n`r
Array := StrSplit(List, "`n")
MsgBox, % Array.5

Esc::ExitApp
But when I change the number 5 in line #13 and try to define it from a variable, it does not work..

Code: Select all

List =
(
Section = 1
Section = 2
Section = 3
Section = 4
Section = 5
Section = 7
)
var := 5

Loop, Parse, List, `n`r
Array := StrSplit(List, "`n")
MsgBox, % Array.var

Esc::ExitApp
Any thoughts ?

sofista
Posts: 645
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Split List into separate strings  Topic is solved

Post by sofista » 29 Nov 2022, 10:41

Try:

Code: Select all

MsgBox, % Array[var]

User avatar
HiSoKa
Posts: 480
Joined: 27 Jan 2020, 15:43

Re: Split List into separate strings

Post by HiSoKa » 29 Nov 2022, 10:49

This is exactly what I needed, Thank you

Post Reply

Return to “Ask for Help (v1)”