Hello again all.
I commented above a few times discussing with Dan about adapting his Palette Organizer to accommodate more than just two numerical digits, after I learned from Peter that letters and in fact almost any characters can be used in those first two characters followed by the ")" to sort and organize macros. Dan was helpful in advising how to adapt his code, based on assumptions I made about how KM would sort characters beyond the two numerical digits. I've been working on it since then on and off, but sadly this has turned out to be a great deal more complicated than I (a) thought it would be and (b) feel it should be.
Thank you to, jonathanl - your post explained the "natural sorting", which cleared up some of my issue, but it turns out it it appears to still be a lot more complicated than that even...
That "natural" sorting combined with the two character limit seems to me to make it extremely difficult to organize macros programmatically in any sensible way. “Natural sorting” makes sense when dealing with file names or any other kinds of names that want to be sorted based on numbers somewhere in the names, without having to worry about padding shorter numbers with extra zeroes or whatever else. That's great. However, that makes sense in situations where you want numbers that can be any number of digits. On the other hand, KM’s sorting only allows for two digits - well… as Peter cleared up for me in my conversation with him about it, it allows for two characters which means we can mix letters and numbers in order to get more than 100. That’s great, except that KM's sorting is making a significant distinction between letters and numbers (to accommodate the “natural” sorting) which screws that up.
Part of my problem is I'm trying to sort macros within their groups but also have them sorted in their groups even when looking at more than one group at a time. I figured to achieve that I could use the first of the two characters as a group indicator and the second as the order in the group.
I have a lot more than 100 macros I'm trying to do this with, which was why I started that part of this conversation in the first place. Perhaps given this natural sorting problem I could use just the 26 letters, but I have more than 26 groups, and a few of my groups have more than 26 macros. Base 36 (10 digits + 10 letters) was going to be enough but this "natural" sorting screws with that.
Ok then I remembered that in my email exchange with Peter, he'd mentioned that "even with just letters and numbers, there's nearly 4,000 combinations. How did he get that (because 36x36 is only 1296)? Ah... 10 digits, 26 lower case letters, 26 upper case letters: 62x62=3844. Fair enough, Ok, let's leave out the 10 digits and work with 26 letters both lower and upper case. I get 52x52 = 2704, though more importantly it means I get 52 groups of up to 52 macros each. More than enough for now.
Ok, so consider my "digits" to be either:
aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
or
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
Wasn't sure which it was so I started testing both. I'd expect I should be able to work with those 'digits' as if it's base 52. Except neither list of digits works reliably! The sort order appears to be:
aa, aA, Aa, AA, ab, aB, Ab, AB, …, az, aZ, Az, AZ, ba, bA, Ba, BA, …
To get the sort order required, I have to ... well... honestly I can't seem to figure out a suitable algorithm - at least not one that allows me to have 52 or 62 distinct groups per the first character. There is logic to that ordering, but it's kind of in groups of four and certainly not the same logic that any English or western counting system uses.
So, admittedly, I’m a little frustrated at this point because I’ve spent days on this to finally get to this point and still not have a solution to my problem when really I’d have thought it was a pretty simple problem (put a number or character combination in front of a string of text to sort it sensibly). Perhaps I have an edge case here in some of the specifics - so maybe it's too much to ask for Peter to adjust KM's inner workings to accommodate this, but then is it really that edge? I have to wonder if there's anyone else out there trying to sort more than 100 macros in certain way and trying to programmatically re-name them to achieve that.
Ok, what am I hoping to achieve from this post? I'm not just trying to rant about my frustrations (I apologize if it does, but I've put some time into trying to identify and clarify the problem, so I hope that's worth something). I guess ultimately I'd welcome anyone with any insights into this.
Is anyone else trying to do anything like this? Perhaps, are there enough people trying to do anything like this to warrant Peter putting the work into some update to how macros sort? Or... is there something I've idiotically missed that should make this a lot simpler than I'm currently seeing? Or... am I just going about this the whole wrong way, perhaps trying to solve the wrong problem?
I'd welcome any insights. Thanks in advance!