How to sort the list properly?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
oldbrother
Posts: 275
Joined: 23 Oct 2013, 05:08

How to sort the list properly?

19 Mar 2024, 11:00

Both "Sort List, D|" and "Sort List, N D|" cannot sort the list properly. Please help.

Code: Select all

#Requires AutoHotkey v1

List :="Class 2. Book 1|Class 1. Book 13|Class 1. Book 2|Class 1. Book 5|Class 1. Book 6|Class 2. Book 12|Class 1. Book 14|Class 1. Book 1|Class 2. Book 2|Class 1. Book 10"

Sort List, D|
;Sort List, N D|

List := StrReplace(List, "|", "`n")
msgbox % List
User avatar
flyingDman
Posts: 2848
Joined: 29 Sep 2013, 19:01

Re: How to sort the list properly?

19 Mar 2024, 11:45

try:

Code: Select all

List :="Class 2. Book 1|Class 1. Book 13|Class 1. Book 2|Class 1. Book 5|Class 1. Book 6|Class 2. Book 12|Class 1. Book 14|Class 1. Book 1|Class 2. Book 2|Class 1. Book 10"

Sort, List, D| F logical_cmp
List := StrReplace(List, "|", "`n")
msgbox % List

logical_cmp(a,b, o) {
	return dllcall("Shlwapi.dll\StrCmpLogicalW", "wstr", a, "wstr", b, "int")
}
Note: V2 will do this natively (using the CLogical option).
14.3 & 1.3.7
User avatar
oldbrother
Posts: 275
Joined: 23 Oct 2013, 05:08

Re: How to sort the list properly?

19 Mar 2024, 12:00

It works perfectly!

Thank you so much! :thumbup: :thumbup: :thumbup:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], DecimalTurn, Google [Bot], macromint, peter_ahk and 355 guests