Coercing a 'Prompt for User Input' to Display/Change a Variable with a Long Value

The Prompt for User Input action is an incredibly useful action. I often use it as a simple debugging tool to pause and display one or more variables in the Prompt field (e.g., Example: %Variable%local_Example%).

The next level of sophistication is to add one or more variables to the Prompt for User Input. This is simple to configure, but there is one characteristic that can sometimes be problematic: if a text value is long, one cannot see the full value (and easily modify it, if necessary).

Unlike the Prompt With List action that does include a width setting (accessible via the gear icon), the Prompt for User Input does not. Instead the width begins at some application minimum and only grows wider if the button labels dictate, ignoring the length of the variable values. In cases like the above, in the past I've intentionally created longer button labels simply to widen the dialog.

Since the above is obviously not ideal, I had tried padding button labels with spaces to widen the labels, but attempts failed due to automatic trimming. Recently, however, I found a method to bypass the trimming and easily adjust the button width, indirectly widening the dialog to expand the variable value fields.

If this is something you'd like to do, download and install this macro and adjust the dialog width. You'll see an orange Execute a Shell Script action that can be easily configured to specify the label and pad_width. For the dialog above, I specified Cancel / 40.


Download: Coercing a PFUI to Display a Variable with a Long Value.kmmacros (17 KB)

Macro-Image


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 26.3 (25D125)
  • Keyboard Maestro v11.0.4
1 Like

I've been using the "Prompt for Snippet" Action for this lately -- I'm finding the ability to put a the multi-line contents of a variable into a scrollable text box to be really handy when dealing with JSON and similar.

2 Likes

Hi, @Nige_S. Thanks for mentioning that action. For a quick-and-dirty check of variables, that action is great. Of course it gets a little more complicated if you want to provide the option to modify more than one value (within one prompt). Also, correct me if I'm wrong, but I think there is no provision for checkboxes and pop-up menus.


It would be nice if the Prompt for User Input action included a width setting.

It would be the coup de gras if a future version of Keyboard Maestro included a new action that combined features from the Prompt for User Input action and the Prompt for Snippet action.

Yes, thankfully there's the amazing Custom HTLM Prompt action! :grinning_face:

1 Like