Text completion popup window?

This may be out there, but I'm looking to see if I can get keyboard maestro to popup a list of text completion choices based on the first letters of the text macro

For example, I have a long list of strings of text from my electronic health record, Epic, which are triggered by their internal macro engine. They are triggered by typing the period followed by the shortcut. So ".last" would then show tens or hundreds of options, which get whittled down as you continue typing. I'll try to include an example screen capture.

Is there a way to duplicate this functionality in KM? or maybe another text replacement program n the mac?

There may be a way to do this in Keyboard Maestro, but as you say, it would probably be easier in another text replacement program. My recommendation is Typinator, and you can see their examples of the kind of functionality you describe here: http://www.ergonis.com/products/typinator/features.html#QuickSearch

1 Like

Hey Michael,

I’m going to second Gabe’s recommendation.

Typinator is going to be faster and easier to use than a Keyboard Maestro solution for many hundreds or thousands of text expansions.

If you really want to explore a Keyboard Maestro solution Dan Thomas posted an excellent Keyboard Maestro Custom HTML Prompt example: Spotlight Search Prompt

I have a test case that uses a 10,000 line text file for input, and it’s pretty fast.


1 Like

Actually, I may have spoken too soon. While I still think Typinator is great and worth looking into, it seems that this is also much easier to pull off with native KM actions (assuming you're using version 8+) than I thought. All you need to do is use the new Prompt With List action to read your text strings and save the results to the clipboard, like this:

Thanks for inspiring me to look into this, as I have a macro that searches a text file myself that I can significantly improve with this new action :smiley:
And belated thanks to @peternlewis as well for adding this in KM8! Now that I know what Prompt With List does (I had no idea it had this kind of filtered search functionality from the name or help/wiki page alone) I can see it being highly useful for all sorts of macros :smile:


The Trigger Macro by Name action works a little like that, and in version 8 you can limit the results to a specific macro group (so your Macro Group containing all your text expansions in this example).


Very nice — and a good bit faster than my Custom HTML Prompt test-case.

Peter — it would be nice if you could pick more than one item in the list.



Hey Chris, nice to have you back again :slight_smile:


Chris (@ccstone), good to see you here again! We’ve missed you.



I'll second Chris' recommendation for @DanThomas' great macro.
Not only is it pretty fast, it is highly customizable, whereas the new KM8 Prompt With List action (KM Wiki) is not.

@DanThomas examples look really cool. But I’m not sure how to incorporate it into my workflow.

I guess I could use the (Dictionary) example. But can anyone point me to a primer on how to actually implement it? I’m not a coding guru, though I’ve automated TONS of stuff using KM so I’m comfortable with the interface.

I basically need to get the returned value into clipboard then pasted in the point where I invoked the Spotlight Search Prompt in the first place.

@Michael_Elliott Have you looked into KM8's Prompt With List action yet? Based on what you described in your OP and your last post about pasting the last value returned to the clipboard, you should be able to accomplish your goal quite easily with a simple macro like this:

Text Completion Popup.kmmacros (1.6 KB)

what’s the format of the list from file though?

@Michael_Elliott If I understand you correctly, here's what the kind of data you show in your original screenshot looks like when accessed with this prompt:

You can type in the prompt at top to filter the list down further:

When an item is selected, the Paste action that follows "Prompt With List" in the macro will automatically paste it from the clipboard.

If you would like more flexibility with how a prompt like this is displayed, then I would also second looking into @DanThomas's excellent Spotlight Search Prompt system, which can list data from files in a similar, but more customizable way (and includes numerous documentation and numerous examples).

I guess my question is what is the format for the file linked to in the macro? The “Prompt With List From File” in the path?

I believe it should work with pretty much any kind of file that contains text (I’ve tested it just now with Word, Excel, XML, and PDF and it showed something for all of them) but you should get the most consistent results with plain text files.

oh! so it’s a text file with just the string for that Macro? What I was asking is if the file has ALL of the strings in it, and what the format is. like “MEFIRSTNAME=Michael, MELASTNAME=Elliott” etc

Ah, I see what you mean now. Yes, for this use case, you'd want to make sure the file has all of the strings you want to access. As for the strings' format, Prompt With List just shows you the strings exactly as they appear. So if your strings are formatted like


That's exactly how they'll appear in the prompt:

And when an item is selected, the same string is exactly what will be pasted, i.e. "FIRSTNAME=Michael". If this isn't what you are looking for, and you'd like a way to display one set of values and return a different set, then you'll indeed want to look into Spotlight Search Prompt and its dictionary arrangement. Here's an example of how that works and what it looks like in practice:

###Sample Data

###Sample Spotlight Prompt

###Sample Results
Upon selecting "Amy Reyes":

Is this more what you had in mind, or would the more straightforward Prompt With List functionality that shows and returns the same string suffice?

I’m more looking to show a list to the left of the “=” and have it return what’s on the right. Some of these strings are very long, and contain RETURN characters, which I’m not sure would help here.

As I mentioned, I looked at the Spotlight Prompt, and played with the examples, but am not sure what I’m supposed to do with the “Keyboard Maestro User Input” that I see in your “Sample Results” above. I’ve played with it and am clueless how I get the result into the clipboard when then can be pasted.

Spotlight Search Prompt returns a variable called sspResult (which you can see in "Keyboard Maestro User Input" above, where it has a value of 16, i.e. the key value of the dictionary name I chose, Amy Reyes) so to paste the result, you just need to insert the sspResult variable through pasting:

Text Completion Popup Window (SSP Version).kmmacros (24.5 KB)

Here's what this version looks like in practice:

After selecting "FIRSTNAME", the sspResult variable, "Michael", is automatically pasted (at least with this version; you can of course just use the "Set Clipboard to Text" action to set the clipboard to sspResult so that you have more control over when the result is pasted).

Awesome thanks!

1 Like