- In theory, this script would work, however, AHK doesn't have built-in handling for stable sort. (I had already added stable sort to my Wish List 2.0.)
- So it might not work exactly right.
- I.e. when it sees two items as having the same value, instead of preserving the order, it allows itself to reorder the items.
Code: Select all
q:: ;sort (add leading zeros, sort, remove leading zeros)
vText = ;continuation section
(
* 1 [[Bakelelite]]
* 60 [[Rose of the Sands]]
* 1 [[Fine Sand]]
* 4 [[Ourobubble Scales]]
* 11 [[Scordion Tail]]
* 11 [[Mantiscore Carapace]]
)
VarSetCapacity(vOutput, StrLen(vText)*2)
Loop, Parse, vText, `n, `r
{
if (InStr(A_LoopField, "[[") = 5)
vOutput .= (A_Index=1?"":"`n") "00000" SubStr(A_LoopField, 3)
else
vOutput .= (A_Index=1?"":"`n") "0000" SubStr(A_LoopField, 3)
}
MsgBox, % vOutput
Sort, vOutput, P7
MsgBox, % vOutput
Sort, vOutput, NR
vOutput := StrReplace(vOutput, "00000", "* ")
vOutput := StrReplace(vOutput, "0000", "* ")
MsgBox, % vOutput
return