Methods to Pick from a List [Tutorial]

This tutorial provides a macro that shows how to use four methods available in Keyboard Maestro to provide a prompt for the user to select an item from a list.

  1. Prompt For User Input with Popup field
  2. Prompt With List
  3. AppleScript with Choose From List
  4. Spotlight-like Prompt by @DanThomas

Each of these methods has advantages and disadvantages. IMO, all of them should be tools in your automation toolkit, so you can always pick the best tool for the job.

Personally, #4 is my favorite, even though it takes a bit more effort to setup.

In the interest of time, I am going to leave it like that for now. I'll come back later to add more discussion. However, there are a lot of key comments within the Macro.

Meanwhile, please feel free to post your questions, comments, and/or suggestions for improvements.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MACRO:   Methods to Pick from a List [Tutorial]

~~~ VER: 1.0    2020-01-11 ~~~
Requires: KM 9.0.2+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Methods to Pick from a List [Tutorial].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


Example Output

Select Method To Use
image

image

OPTION 2. Prompt With List
image

image

image

Results


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Provide Examples of Four Methods of Using a Pick List in KM

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Trigger this macro.
  3. Select the Pick List Method you want to use.
  4. Observe the results.
  5. Study the Macro to learn and understand each of the methods.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .

Make These Changes to this Macro

  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)
    • This Macro may be run as is, but you may want to customize it for your use case
    • Local__ListOfChoices
    • Messages set based on Item selection, in the Switch Case at the bottom.
    • Spotlight Search Prompt Options

REQUIRES:

  1. KM 9.0+ (may work in KM 8.2+ in some cases)
  2. macOS 10.11.6 (El Capitan)+
  3. MACRO: Spotlight Search Prompt by @DanThomas

TAGS: @Prompt @PickList @Lists @AppleScript @Tutorial

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4 Likes

a gem ! thanks very much ! you have excellent didactic skills

1 Like

sir, tried it but #2 and #4 don't work here

EDIT: ok, #2 needs some additional macro

EDIT 2: nonetheless, learning a lot, thanks!

All is obviously working fine for me, running Keyboard Maestro 9.0.4 on macOS 10.14.6 (Mojave).
If you can provide exact details about what is not working, and the versions of KM and macOS you are running, I'll try to help you debug.

Can you be specific?
I am not using any other Macros for Option 2. Prompt With List.
It is a straight forward use the the KM Prompt With List action:

As stated in the Macro itself, Option 4. Spotlight-like Prompt by @DanThomas , requires download and installation of the macro by Dan:

Great! I hope you find it helpful.
If you have any further questions, feel free to ask.

This breakdown is so wonderfully done. #2 and #4 are so special and clean. I know this took some time to put together @JMichaelTX (and @DanThomas for #4) .

Thank you for all of your time, patience and education. Bravo!

1 Like

@JMichaelTX sorry, was in a hurry, meant I hadn't noticed action #4 requires an additional macro.

As for #2, it worked once, then it stopped working.
I deleted it then re-installed it again but again no dice, didn't work.
But no worries, I just saw it's the list action.

Thanks for your time, already changed a macro to use #3!! :smiley:

Can you please provide details of what "didn't work" means?
If there is a bug, I'd like to fix it.

Anyone else seeing this behavior?

Maybe this is what is causing the problem.

When the Prompt with List first comes up it looks like this:

image

So, in this case, you much choose from one of the items BELOW the item highlighted in brown.

So, when I type a "t", it selects "Tom", which is a valid choice:

image

as soon as I select it, it disappears, 2MB GIF below:

They all work for me. Sorry.

Thanks for showing the GIF -- that's very helpful.
However, it is very confusing why it stops there.

immediately after this script action:
image

Please insert this action:

Display Text.kmactions (1.3 KB)

%ExecutingMacro%
%ICUDateTime%yyyy-MM-dd hh:mm a v%

Method Selected: >>>%Local__Method%<<<

Run the macro again, and you should see the Display text immediately after making the Method selection.
And make a screenshot and post.

Thanks.

P.S. Of course, you could use this as a learning opportunity to use the KM Macro Debugger . :wink:
and step through the Macro to see what is happening.

screenshot:


04%20AM%201

The script looks fine, don't know why it happens.

Also, duplicated the macro and left only the parts from the script #2 and it runs fine
:scratches-head:

P.S. Of course, you could use this as a learning opportunity to use the KM Macro Debugger . :wink:
and step through the Macro to see what is happening.

The Macro debugger?? :scream:

hmm,:thinking: it gets more interesting:

with the Display Text in a Window macro added, now the List shows, but only if I don't close the window, see GIF.
If I interact with the window, it goes away.

In the "Prompt with List", are you selecting and item, and the pressing RETURN?
If you press ESC it will cancel the Prompt.

I used the mouse.
Tried with the keyboard, same result.

Just thought this might be related to the other bug I've experienced, the keyboard not responding in input dropdowns... :thinking:

Don't dedicate more time to this. Thanks for your time! really appreciated.