Key commands for ordering of actions in a macro, in km editor

ok this may sound insane, but it's not.
On the subject of using keyboard maestro on itself, (which seems crazy at first but i think it's essential actually), I'm looking for a way to easily get a handle on the ordering of the actions list in a macro. Probably one of the main reasons I need this is because there seems to be no way to add a new action ABOVE the selected one. but in general, it's pretty crucial to be able to nudge actions up or down in the list. and I don't think there's any key commands for doing that, so I've always tried to make them.
The one I've been using is functional, but quite slow and it fails if you do it too fast. It relies on copy/paste. "nudge up" means cut the action, press up, then "paste above" etc. that sort of thing. It works, sort of, unless you try to do it fast.

So I'm looking for a more solid way to manipulate the ordering of the actions. like the same thing as what you can normally only do by dragging them with the mouse and inserting them at a different spot in the list. looking to press a key and have it just get displaced upwards in the list (or downwards).
And this leads me to trying to open a door which I've wanted to for a long time, which is javascript automations. Or maybe that's not what I'm looking for, .... but I'm looking for some advanced tactic to get a hold of this functionality of the kme app. And in many other apps ... where I just can't seem to get a handle on it.
Another example would be, when inserting an "activate app" action, i have a macro that automatically inserts that and then opens the pop-up menu for the app name, and goes to 'other', so it sets me up to type the name. I do this using applescript. Besides that, on a more granular level, I also have key commands for "button 1" "button 2" etc, and "pop up menu 1, and pop up menu 2", of a selected action. These are all applescript, but, wow, applescript is just so slow for reasons I've never figured out. Also, ... this applescript trick fails if the action is nested in an "if" action, because the hierarchy would be tweaked. I've actually made a very verbose and insane updated applescript which systematically checks for "of group of group of group of group of group" etc, and all the way back, for up to about 5 layers deep, and that does work, again it's quite slow.

So I suppose the thing that ties this all together, is I am looking for new techniques to really get a handle on these action cells, in the keyboard maestro editor. and hopefully be able to use this knowledge for other apps as well, but the "keyboard maestro editor" app is surely one that everyone here knows, so I figured it would be good to start here.

Some people on here have made some amazing contributions using crazy script tricks, and I get the feeling the answers I seek are out there. any help appreciated, sorry if this makes no sense.

Very reasonable request.

We might be able to find a trick to make that work reliably.

Part of the problem is that KM actions can be selected or the fields within them. However if we first use the keystroke to minimize all actions, then that problem should go away. Try OPT-LEFT ARROW before moving things around and the reverse afterwards. Not sure if this will make it work faster but it will prevent internal fields from getting selected.

Perhaps what you want, if I may speculate, is for the KM Editor to support AppleScript. Maybe it does. Interesting idea. But I can't help with AppleScript since I haven't passed beyond noob at this feature.

I have tinkered with KK macros modifying KM macros. It used to be necessary before Find Image supported files.

That remind me. one thing I would like is a macro that indicates whether the KM Engine is busy recompiling a macro. That way I can know how long to wait before triggering a macro that may have been updated by the user or by my programs. Something like this:

Pause Until %KMEngineBusy%=0

Sorry I can't comment on all your comments.

This works for me to paste ABOVE the selected Action:


AFAIK, that is correct. Perhaps @peternlewis could take that as a feature request to add a shortcut to MOVE a selected Action (or block of Actions), up, down, top, bottom.

Confirmed. That work's for me, but didn't really test the speed of it.

You have some good ideas that would be great if KM provided.

I haven't really messed to much with moving Actions around, but I do make great use of MACRO: [KMFAM] Favorite Actions and Macros by @DanThomas. It allows you to make highly customized Actions and then save them in a library. You can then easily search the KMFAM library and insert the Action (or block of Actions).

I did create one macro to drag/drop objects using the keyboard. Maybe that would be of interest to you:
MACRO: Drag/Drop Mouse To/From Points Selected by Mouse Position

Still holding out for an awesome way to "nudge" actions up and down the macro list.
The method I currently use involves "copy", arrow keys, and "paste above". but this method fails if you try to do it too fast. For example, if I give the "nudge up" command 5 times fast, chances are the action i'm nudging will vanish, and i'll get a duplicate of another one.

I'm reading all this amazing javascript, json, etc from Dan Thomas, CStone, Rob Trew, etc, and I'm literally drooling at the possibilities. Too bad I don't understand any of it.
Maybe if I hang around these boards long enough i'll find the clues i need .....
currently trying to dissect some of the scripts I've found on here, to try to find any clues of how to access the order of actions and figure out how to give commands to change it ......

I think we'll have to wait and see if @peternlewis deems this request worthy of implementation. I agree it would be cool.