Code: Select all
Contents := "
(
wwwww=3
fffff=8
ggggg=2
)"
MsgBox Sort(Contents, "NR", NumSort)
NumSort(a1, a2, *)
{
a1 :=Number(StrSplit(a1, "=")[2])
a2 := Number(StrSplit(a2, "=")[2])
return a1 > a2 ? 1 : a1 < a2 ? -1 : 0
}
Code: Select all
Contents := "
(
wwwww=3
fffff=8
ggggg=2
)"
MsgBox Sort(Contents, "NR", NumSort)
NumSort(a1, a2, *)
{
a1 :=Number(StrSplit(a1, "=")[2])
a2 := Number(StrSplit(a2, "=")[2])
return a1 > a2 ? 1 : a1 < a2 ? -1 : 0
}
Code: Select all
Contents := "
(
wwwww=3
fffff=8
ggggg=2
)"
MsgBox Sort(Contents,, NumSort)
NumSort(a1, a2, *)
{
a1 :=Number(StrSplit(a1, "=")[2])
a2 := Number(StrSplit(a2, "=")[2])
return a1 < a2 ? 1 : a1 > a2 ? -1 : 0
}
Thank you very much, much appreciated for your helpboiler wrote: ↑27 Mar 2024, 02:42You have a custom function to determine how things are sorted. Specifying some options has no effect. There is no way for AHK to know how to change the results of your custom function just because you specified a couple options. To change the sort order, you have to change the function itself:Code: Select all
Contents := " ( wwwww=3 fffff=8 ggggg=2 )" MsgBox Sort(Contents,, NumSort) NumSort(a1, a2, *) { a1 :=Number(StrSplit(a1, "=")[2]) a2 := Number(StrSplit(a2, "=")[2]) return a1 < a2 ? 1 : a1 > a2 ? -1 : 0 }