Page 1 of 1

### Ini get max numbers

Posted: 04 Feb 2018, 20:10
[Test]
1=1
87=0
7=5
13=7
43=10
39=30
46=15
45=75

I want to get 7,43,39,46,45 (in different variables, like 7 be VAR1,43 VAR2) because these six numbers hold the largest key value

Help? ### Re: Ini get max numbers  Topic is solved

Posted: 04 Feb 2018, 20:47
This puts them in an array called Ordered. You could assign them to individual variables if you would like. By the way, you left 13 out of your expected results list.

Code: Select all

``````IniRead, SectionText, test.ini, Test
Numbers := {}
Loop, Parse, SectionText, `n
{
StringSplit, Element, A_LoopField, =
Numbers[Element2] := Element1
}
For, Key, Value in Numbers
NumList .= Key "|"
Sort, NumList, N R D|
Ordered := StrSplit(NumList, "|")

; Results are in the array named Ordered.  The following is just to output the list in a single MsgBox:

Loop, 6
TextOut .= Numbers[Ordered[A_Index]] ","
StringTrimRight, TextOut, TextOut, 1
MsgBox, %TextOut%``````

### Re: Ini get max numbers

Posted: 04 Feb 2018, 21:02
Thanks a lot, working perfectly! 