[KM] Put Selected Actions into Group Action

That was probably the problem.
Notice in the Alert I say to

By stopping the macro you caused it to fail. :smile:

Silly me. I guess in the future when someone says “and press continue”, I shouldn’t be surprised if it doesn’t do what they say it will, huh? :open_mouth: LOL.

Perhaps the message was too easy to overlook.

I have modified the Alert to make it more explicit, and posted the update to Ver 1.1.1 in my OP above.

AH! You were serious! Thought you were kidding.

I wish we had an Alert that only had an OK button. I’ve wished for it several times.

We do - use the Prompt For User Input action.

I thought about that later. I should probably update the macro to use the Prompt.

Well, now I just feel stupid. :smirk: Of course. Duh.

Thanks!

If I select the top action in a macro and execute this macro, the Group ends up underneath the next action. Like this:

Is there a way to adapt this for Repeat, If Then Else, etc.? I’ve tried to kludge my way through it but have failed so far.

It works with all those things. What issues are you having?

I’d like to have a similar function that places the selected actions into a Repeat Action, or into an If Then Else Action, or a For Each, etc. I’m still trying to get it working myself but am having little success.

Yeah, that’s not going to be easy, because, as I’m sure you’ve found out, you can’t just paste in the Repeat action (for example) then paste in the actions that were cut. They won’t paste in the right place.

Do you happen to know JavaScript? If you do, I could give you some ideas of how to do it. I’d write it for you, but it’s not something I’d use since it’s fairly trivial to do it manually, and I’m focused on other things right now.

Yes I’ve seen. I’ve been trying to use keystrokes to position the cursor for pasting the actions back in, but there are too many variables about what other actions may be placed around the Repeat to do so automatically and reliably.

I don’t know any JS, but as you’ve noted it’s not a big enough issue to worry over and further. Usually when I’m planning actions that will repeat or be If/Then/Else’d, I know ahead of time :slight_smile:

Thanks!

1 Like

It’s possible @JMichaelTX could figure it out, and I’ll let him respond to that. :slight_smile:

This works for me:

Manually

  1. Copy the Repeat Action to a Named Clipboard, I'll call "KM Repeat Action"

Select the Actions to Move

In Your Macro to Move Actions to Repeat Action

This is the same as my macro at the top post of this topic,
EXCEPT:

  1. Uses a different Named Clipboard for "Repeat Action"

  1. ADD 3 TAB Keystrokes after paste of Repeat:

You should be able to copy my macro, rename the copy, and make these changes.

1 Like

Use it all the time :joy:. One suggestion: After the group is created immediately select Rename from the Gear menu — it is always what I do after executing this macro, and is harmless in any case.

Please feel free to post your version of the Macro that adds this feature.

Ah, no fair making me do some work :wink: Should be straightforward. I’ll get back to you.

@JMichaelTX Thanks for this Macro! I tried to make one before but abandoned it since it wasn't dependable. This seems to be better.

I added Renaming after (as also requested by @MitchellModel), using the advice yourself and @peternlewis provided in the other thread.

Note that the renaming portion will fail if it there is another unnamed Group visible on the screen (since it relies on Found image). I didn't bother solving it, since anyone who uses this will likely be renaming their other Groups anyway.

What would be perfect would be a fallback - so that if no actions are selected, it creates an empty group. Not sure the best way to approach this... any ideas?

Keyboard Maestro “[KM] Put Selected Actions into Group Action - ADDED RENAME” Macro

[KM] Put Selected Actions into Group Action - ADDED RENAME.kmmacros (103 KB)

2 Likes

Very nice, Joel.

I love to see people take one of my macros, and enhance it for their own use.
That’s the main reason I post macros – to give others a good starting point and example.

Well, you could check to see if the Clipboard has changed AFTER the COPY in the macro.
If no change, show a notification instructing the user to first select the Actions to put into the Group.

To check the clipboard, see:
MACRO: [CB] How to Detect When Clipboard Has Changes [Example]

1 Like