MACRO: Palette Organizer v1.3 (updated Dec 3, 2021)

OK. There's 2 places (I think).

In the above action there's some code that extracts the sequence numbers from the macro name. It has a regular expression that would need to be changed:

var matches = info.macroName.match(/^(\d\d)?(\))?(.*)/);

Instead of just digits, it would need to get digits and numbers.


The the next action is the Custom HTML Prompt, so obviously you'd need to change it:


When you first look at each set of code, it might look like there's a ton of stuff in there, but it's almost all modularized. For example, you can ignore the KMEditor and KMEngine functions. You won't need to change those. The same holds true for most of the stuff in the HTML file.

Let me know if you have questions. :stuck_out_tongue:

Ahoy. Having made great use of Palette Organizer, I've just discovered I now get a fatal error.

Error in 'KMWindow':
Variable 'palorg_MacrosInfo' not set
Error in 'KMDidShowWindow':
undefined is not an object (evaluating '_desiredWindowPosition.top')

I'm running PO v1.2 with KM 9.0.5 under macOS 10.15.4.

I'd be grateful for any advice. It's a great macro.

—Bryan

There's only two things I can think of. The first is, make sure you've selected two or more macros. The second is, make sure you've got KM in "Edit" mode (the button at the bottom of the editor, in the middle.

Let me know if that helps.

Thanks very much for your quick reply. I did a clean reinstall of KM and that's done the trick.

Interesting! I wonder what happened? Anyway, glad you fixed it.

From an email I got from Peter:-
(See also http://www.naturalordersort.org/)

Keyboard Maestro uses a number-sensitive sort, so all your macros that start with 0 or 00 are treated the same, as if they start with 0.

After that they are sorted alphabetically by the next character (which is largely ASCII order in this case, except also case insensitive. So:

space-space, space K, space N, <, =, |, a, A

After that comes the macros that start with the number 1, ie 01 or 1, followed by space N, space R in order.

After that comes the macros that start with the number 2, ie 02 or 2, followed by space K, space O in order.

Then the remaining numbers in order, 3, 4, 5, 6, 7, 8, 99.

This technique was pioneered several decades ago by Stuart Cheshire I believe, and was used in many of my programs for decades. It is now used across the system, including in the Finder.

It allows correct sort order for things like:

Keyboard Maestro supports a specific way of doing manual sorting which is to use a two character code followed by an ), ie:

A0)

These codes will also be hidden in various places (like palettes and menus).

See: https://wiki.keyboardmaestro.com/manual/Glossary?s[]=sorting&s[]=characters

1 Like

hi @DanThomas

hope all is well. I started getting these errors lately when i try and launch the macro

im using version 1.2, any clue how to address this?

thx!

Z

Not a clue. Sorry!

@DanThomas Is there a way to have a space added after the number? Like instead of 01)Macro it would be 01) Macro?

This is an impressive macro, by the way!

There's a reason I didn't do that, although I can't remember why. It was a good reason, though. :smile:

2 Likes

@DanThomas Is there a way to modify the code so I can see the number of the macro? I understand that using the “01)” format, "The macros will be sorted based on the code, but the code will be stripped off before display in the palette (or status menu)."

However, I would prefer to see the number because I like using the number keys to activate a specific macro when the palette is open.

Something like this:
image
Instead of this:
image

So my question is, how can I change the palette organizer to rename the macros with a format like "1)" so the numbers remain visible?

Leave the ) out of it all together
the nn) notation is to sort the macro name display
you want to just NAME your macros "1 macro a"

1 macro a
2 macro b
9 last macro

@jonathonl
Is there a way I can use Dan's palette organizer to number the macros without the ")"?

Sorry but i have not used Dans system, so just code it manually if that is what you want.

Nope, sorry.

1 Like

In my experience with palettes it’s better to leave the ‘)’ in as that distinguishes better from numbers in the text of the item name.

(But then I’m using numerics in my item names more often than most do.)

If I understand you correctly, a the macros on a normal palette are NOT triggered by anything in the name of the Macro, but by the actual trigger you assign. So why not just assign the numbers you want to each macro, and config the pallett to show the triggers, like this:

1 Like

If you’re going to append the numbers then maybe put a dot in front of the number. To, as I said above, distinguish from numbers in the text of the action title.

(In my case data set qualifiers can’t start with a number, but they can contain them and dots are used as qualifier separators. So maybe dot is the wrong thing for me to prefix a numeric choice with.)

I'm not sure whom you are replying to. If to me, the numbers shown at the "end" of the Macro name are not part of the name, but the Trigger for that macro.

I’ve lost track of who I’m replying to, too. :slight_smile:

My entire point in this thread is to think of ways of using numbers as shortcuts when invoking palette items. But without inadvertently selecting the wrong item - because it contained a numeric digit.