Autocomplete Menu (HTML) - Passing Variables to KM?

When triggering this macro, I would like to get a list pop up, like this example code in HTML that i found that autocompletes as i type.
After i selected the right one on the list, i would like to pass the variable to KM for further use.

I know about html prompt, but i don't know how to implement?

Custom HTML Prompt.kmactions (8.9 KB)

here's an example of a HTML prompt

and how to pass it to KM using a Switch action:

Hey @gideonmurray,

Keyboard Maestro has a built-in action for that.

Prompt With List action

Screen Shot 2020-12-14 at 04.12.54

Prompt with List -- Example v1.00.kmmacros (4.8 KB)

It'smuch simpler to use than the custom HTML prompt.

Make sure you look over the options in the tools pop-up menu of the action:

image

-Chris

1 Like

@gideonmurray btw, be sure to check this thread, might be helpful to you to use the palette approach

This is probably the best approuch, thanks :slight_smile: I guess theres no way for this window to pop up at a specific area on the screen? As this might be quite important in context of how i want it to operate.

which one? the HTML one or the Palette?

Palette: you can set up your preference, either keep its position, or make it appear under the mouse:
Screen Shot 2020-12-14 at 2.20 PM

Hey @gideonmurray,

No, you can't adjust where it pops up.

But – you can move it once it pops up by using a submacro called asynchronously just before the Prompt with List action.

Prompt with List ⇢ SubMacro ⇢ Position List Window.kmmacros (1.8 KB)

Change the position coordinates in the AppleScript to move the window around.

-Chris

I never looked at conflict pallets before, and it does create a very interresting way to work, thanks for the tip :slight_smile: I'm not sure how would you be able to use a conflict pallet with an autocomplete function?

What am i doing wrong? Its not moving to the co-ordinates?
Keyboard Maestro Actions.kmactions (1.6 KB)

There's a reason why the move action is in a sub-macro:sunglasses:

Main Macro:

Prompt With List Example.ccs v1.00.kmmacros (5.4 KB)

Sub Macro:

Prompt with List ⇢ SubMacro ⇢ Position List Window.ccs v1.00.kmmacros (4.5 KB)

Placing the AppleScript in the same macro as the Prompt with List action and sequentially after it fails, because the macro pauses execution while the Prompt with List action is on-screen. So by the time the AppleScript is executed the prompt window no longer exists.

Install both macros and make sure they are correctly linked in the ‘Execute Macro’ action.

-Chris

You can't.

You have to have all the macros preconfigured to use the same keyboard shortcut, and then when Keyboard Maestro creates the conflict palette it tries to choose the best letter in the macro name for you to type to get to it.

Here's a small test group, so you can experience how it works.

Screen Shot 2020-12-14 at 23.50.52

Conflict Palette Test Macros.kmmacros (14 KB)

Pressing the different highlighted letters allows you to quickly drill-down to the item you want.

For some applications this is great, and you can very quickly perform tasks once you've built some muscle-memory.

But – I don't much like palettes. I do use them for certain things – especially when I want one-key access to various functions.

Here's my Google Chrome 1-Key Palette:

Screen Shot 2020-12-14 at 23.58.23

I have a hotkey that opens and closes this, so it's ONLY open during the times I want 1-Key access to the relevant commands.

For quick access to commands that don't have hotkeys I generally prefer the Prompt with List style UI. It lets me type a few letters or a couple of words to quickly get where I want – and i can add mnemonic tags to these commands for even quicker access.

-Chris

1 Like