## Ini get max numbers Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
HIAC
Posts: 111
Joined: 11 Oct 2017, 17:59
Location: Republic of Serbia

### Ini get max numbers

[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?
boiler
Posts: 3337
Joined: 21 Dec 2014, 02:44

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

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%``````
HIAC
Posts: 111
Joined: 11 Oct 2017, 17:59
Location: Republic of Serbia

### Re: Ini get max numbers

Thanks a lot, working perfectly!