User Input - Chose A Macro

Continuing the discussion from 'Execute Macro' by Name in a Variable:

I am not quite understanding how to get a macro to be selected with user input. If someone could guide me. I have made an example and don't understand how to get the output I am looking for.

Demo User Select Macros Macros (v10.0.1)

Demo User Select Macros Macros.kmmacros (9.0 KB)

https://wiki.keyboardmaestro.com/action/Prompt_for_User_Input#Menu_Field

I looked at your code. You made a few mistakes. If you don't mind, rather than just correct your mistakes, I would like to start from scratch using the simplest method I could think of. But there are many ways to solve this. If you want a different way from my way, just ask.

The simplest way is to just create some buttons on a prompt like this:

You could create the above prompt with this action:

image

There are other ways to do it also, more like to your method, but this way seems simpler to me. Is it good enough for you?

After the above action that creates that prompt you could do the following action, and call the appropriate macro in the three empty blocks.

image

I could also take the approach of fixing the mistakes in your macro, but that would end up with a longer solution that this one, and I think you should be using the simplest solution.

I am sorry to be so dense I have tried all sorts of things with %ResultButton% using %ActionButton% how the text is processed. I am not getting this for some reason. Here is the macro I thought I needed to make this work but I am missing something.

Demo User Select Macros v2 Macros.kmmacros (7.8 KB)

I'm so sorry. I really intended to say %PromptButton% not %ResultButton%.

"Result Button" used to be a variable in KM (if it's still there, it's deprecated.) I actually read the following page before responding to you, but I think my short term memory failed me and I typed the wrong word.

https://wiki.keyboardmaestro.com/action/Prompt_for_User_Input

1 Like

I'm not sure if this is the best approach.
If @skillet just wants to be able to choose from a list of user-created macro list, then the action:Show Palette of Macros [Keyboard Maestro Wiki] action is the best way to go.

For instance, on my Mac, an action like this:
image
Will show a palette like this:
image

I can also use hotkeys to trigger the corresponding macro from the macro palette.

2 Likes

You could be right, that your approach is better. As I said, there are many approaches. I just picked one that was similar to his, but simpler. My choice may be the wrong one.

The majority of people who ask for help are asking for help with a specific problem that may not even be the right solution to their real problem. But we can't read minds, so we do our best.

1 Like

You are right and my apologies for any ambiguity on my end. Your solution was fantastic and taught me some cool things that absolutely will help with even more solutions. I read through that page but read too fast I guess and needed to just slow down.

I figured something like this had to be in there already and I looked for exactly this which can be even faster since it brings up a conflict like pallet of sorts that you can just press a single key to select which one you want. Thank you @Sleepy and @martin for your help and time both answers were very helpful!

I have updated the macro group for anyone else reading through this thread in the future to see both solutions.

Demo User Select Macros v3 Macros.kmmacros (10.7 KB)

Update: I am so excited thinking more about @Sleepy comment about not reading minds. I was actually going to end up using the @martin method and then I realized I can do what I need with one prompt with your method and never would have thought how to do that.

Anyway both methods are great and I will no doubt be using both quite a bit in the future. Thank you for adding to the bag of tricks.

1 Like