[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?
Ini get max numbers Topic is solved
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%
Re: Ini get max numbers
Thanks a lot, working perfectly!
Who is online
Users browsing this forum: Anput, DiegoSouto, mikeyww, Rohwedder, Sniperman and 393 guests