[I suspect this has been done, but I can’t find it.]
I would very much like a KM editor macro that encloses the currently selected steps in a newly created group action. There is an issue about non-contiguous selected actions, but I can live with however the macro would deal with that. Not only would this be very convenient, but it makes more intuitive sense than creating the group first than dragging the steps, especially because you lose your selection when you create a group directly.
There’s one situation where it puts the group in the wrong place (off by 1) - can’t remember whether it’s when the actions are at the beginning or end. But just move it when that happens.
It happens when all of the selected Actions are at the TOP of the macro.
I'm sure there must be a fix for this, I just haven't gotten around to figuring it out. Any ideas?
Similarly, I wrote a few trivial macros for the KM Editor that insert actions I use frequently above and below the current selection:
Action
Keybinding toInsert Below
Keybinding toInsert Above
Comment
⌥⌘C
⌥⇧⌘C
Group
⌥⌘G
⌥⇧⌘G
Keystroke
⌥⌘K
⌥⇧⌘K
and so on.
These macros are very simple. The ones that insert above do so simply by beginning with an uparrow keystroke. This of course doesn’t work if the top macro is part of the selection. I haven’t found a way to hack around this.I haven’t found a simple way to make any of the “above” versions of the “before” version of these to insert before the top action.
[Side note about tables. Discourse formatting does not support tables. (See 2.5 year unresolved discussion at Discourse Meta. But it does support (at least) very primitive HTML. Very primitive. I couldn’t even get the first heading cell to be top-aligned, and a br tag within one of the header cells worked in the preview but not in the actual post.]
If you are referring to my macro, yes, it inserts the Group above the selected Actions.
If you are referring to Dan's system, it inserts below the currently selected Action, just like KM does natively. Obviously, if you want it above, then select the above Action prior to triggering the macro.
I wish there was a foolproof way of controlling (via automation) where something gets inserted in the KM Editor but there isn't. Even JM's Group macro (which I highly recommend) doesn't always insert the group in the correct position, although it does 95% of the time.
Perhaps someday Peter will give us more control, but until then, we take what we've got.
I don't understand what you are referring to — take the simplest possible example: insert Simulate a Keystroke above the currently selected action(s). And is Paste Above — whatever it is — able to paste above the first action?
I see – you're just inserting actions by giving them keyboard shortcuts.
No there's currently no built-in insert above capability in the Keyboard Maestro editor.
You'd have to roll-your-own by saving a template to a variable, named-clipboard, or file and then copying it to the clipboard as the appropriate data-type and then pasting-before.
Or you could write a macro to:
Insert action(s)
Cut
Up-Arrow (or more depending upon what type of action)
Paste-Above
The former takes more effort to set-up but feels more organic and lets you set up templates the way you want them. (For instance I nearly always want the Display Text to display in a window.)