"prompt for user input" but make it look like "search the web"

The "Search the Web" form that pops up when calling that action is incredible. Beautiful. Elegant.

The "Prompt for User Input" form is ugly.

Yes, I know I can create a custom HTML form, but since KM already has a beautiful, simple input form, can I please use that instead?

Prompt With List has a similar layout; would that meet your needs? Without knowing what you're trying to do, it's hard to say whether or not it will—what are you trying to accomplish?

The reason Prompt For User Input can't be that elegant and clean is that it's a much more powerful mechanism that supports pop-up menus, checkboxes, and any other manner of things, none of which lend themselves to showing and selecting from a list based on real time typing.

-rob.

I want a one-line prompt asking for some text. I basically want exactly what already exists with the "Search the Web" form, I just want to be able to define the entry as a variable and do something with it other than search the web.

Prompt With List looks cool. I just want something that lets me type my entry. It's odd that Prompt With List and Search the Web look so cool, but Prompt for User Input doesn't.

Prompt With List won't quite do what you want then, as it's designed to show a list and allow selection from it via typing. If you just want a pretty one-line input box, then a custom HTML prompt is probably the best bet.

Also, how would Prompt for User Input look similar when it has to support all of this? It uses the standard macOS dialog UI elements, so it matches the rest of the user experience.

All of those things are standard macOS widgets; recreating them doesn't seem worth the effort involved, given users are used to seeing those things elsewhere in the UI. And because it supports all those things, it can't be just a simple "enter some text" window.

But you could, if so inclined, write a bunch of HTML and CSS to replace all those widgets and that functionality with whatever you like ... but that seems like a ton of work :). If/when Apple ever updates their standard widgets, I imagine Keyboard Maestro will gain those new looks, with very little work on Peter's part.

-rob.

I'm saying it'd be great if there was an additional input option. It doesn't have to mess with Prompt for User Input. It can be called Simple User Input and can use the exact same format as Search the Web, except it lets me define a variable with the text I enter instead of searching the web.

I only ask because it already exists. Why didn't KM use the existing standard MacOS widgets for Search the web? Because the one they designed is awesome, that's why. So I'm just asking if I can have that awesomeness that already exists for my own purposes instead of only searching the web.

Sorry, I didn't get that when I read your text; I got "why doesn't this feature look like that feature?" My bad for misreading what you were asking for—@Peter will have to chime in on his thoughts on a new simple user input box option; I think it's a great idea, personally.

There are no macOS widgets in that box, it's just an empty text input area with an icon.

-rob.

EXACTLY. :slight_smile:

Here is an option, if I'm understanding your desire.

You can use a Trigger Macro by Name with a parameter and do anything you want.
I did a post about this a few years ago: Trigger Macro by Name Action - Passing Parameters Part 2. This action uses the Trigger Value to pass that parameter. In the link above, this is the important line: Passing Parameters

You can pass parameters (v8+) to the macro via the %TriggerValue% token by adding // and then the parameter to your search string. The //and anything after that will be ignored in the search.

I use it to tag, to search, to journal, etc.

Even though this is a web search that I'm showing below, you can still use it for other instances. This one I'm showing how to search for a topic or images of a topic. The macro is included in my identified post.

ScreenFlow

Bottom line, if you want something quick to enter a parameter, Trigger Macro by Name and using the //{variable/parameter} is an option.

I hope this helps, if not, please disregard.

KC

That's very cool. I have to manually press right arrow after calling it to be able to type after the // . For some reason triggering a keystroke doesn't work here, but it's pretty cool

KM is yours to command! When things you want aren't "built in", try spoofing them in KM instead.

The "Search the web with Google" action doesn't look particularly special. There's a default Google URL and I'm guessing the %Search% token is whatever the person types in to the dialog.

KM has a URL Trigger which can take parameters.

Putting those two together and you can see that

kmtrigger://macro=macroName&value=%Search%

...could let you fire off a macro that does something with whatever was typed. Pop that into a sub-routine with a way to determine if the dialog had been used or not and you might have something useful...

The sub-routine:

SUB - Input from Web Search Prompt.kmmacros (3.9 KB)

Image

Demo of use:

Variable from Web Prompt.kmmacros (2.9 KB)

Image

As written, it doesn't need to be a sub-routine because it is using a global variable -- the calling macro could just tie in to that. But I'm keeping it as a sub because

  1. I'm hoping smarter people than me can work out how to do this without a global
  2. If we only use within the sub-routine it's relatively unlikely to be interfered with. 3. A sub-routine can return a value, meaning we don't have to reset the global then "Pause Until..." or similar in the calling macro

Perhaps this'll give the gurus some ideas on where to go next :wink:

As another approach, here's a functional custom HTML prompt that takes the input and saves it to a variable:

Download Macro(s): Text input box.kmmacros (3.5 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.4.1
  • Keyboard Maestro v11.0.2

Here's how it looks in action:


Very important note: I wrote roughly 0.00005% of this macro. It's just a very lightly-edited version of @mrpasini's solution in this post:

All I did was slightly tweak the CSS to make it look more like the Spotlight input box. You could do a lot more with this, obviously, just by working the CSS and HTML. Note that if you want to get rid of the window title, then the window can only be closed by pressing Return; Escape doesn't work on a window without a visible title bar.

-rob.

1 Like