Prompt for User Input — Larger Text Area

Hi Everyone. I'm currently using Drafts to quickly capture text. But I'm realizing that KM could just as well do what I need it to do, which is prompt me for content, then create a new page in my Craft app with the content I just provided. This works almost perfectly the way I've set up a macro in KM.

The one caveat: I can't keep typing in a larger text area with the popup user input window. It's just a single line text field. Is there a way around this?

I think the question came up before on the forum.

As far as I know, there is no way to do that with the User Input Prompt. You will have to use the action:Custom HTML Prompt [Keyboard Maestro Wiki] instead.

For example, I use this HTML prompt to post announcement to Canvas courses:

1 Like

May I make a small correction? It actually does support multiple lines of text if you press OPTION-RETURN at the end of each line. It simply doesn't let you see those extra lines at the same time. You can even scroll up and down through the lines using the arrow keys to see all the lines individually. You can do things like selecting/cutting/copying/pasting multiple lines of text using the keyboard or the mouse!

I'm not saying this is good enough for you. I'm just saying it does support multiple lines. I'm not very good with the Custom HTML action in KM, but it shouldn't be too hard to create a visible multi-line text field if you need one.

3 Likes

Thanks for the suggestion. It's not 100% perfect resolution, but adequate, and I didn't think to check this.

I couldn't find an easy example either, made this plug-and-play textarea for KM:

You can also do this in Keyboard Maestro 11 with one single Action, using the new Prompt for Snippet Action

In this example the input box is set to display 16 lines (as the token used is %Ask16%). But if more lines than 16 are entered the dialog will scroll to accommodate them. A token of %Ask8% would make a dialog showing 8 blank lines.

EXAMPLE Larger User Input Field.kmmacros (3.3 KB)

EXAMPLE Larger User Input Field

2 Likes

That sounds promising - I just upgraded to 11 to try it, but my Snippet dialog has no text field. Am I missing something?

Can you post the macro? Without seeing the macro, it's hard to say why it's not working.

-rob.

1 Like

If you download the Example Macro I posted, I think it will help you understand how the Snippet Action can work.

It needs to include a token %Ask% for each snippet. I used %Ask16% to get it to make a dialog with 16 blank lines. And you need to set it to save to a Variable if you want to make use of the text you enter.

@Zabobon That's helpful, thank you - I didn't realize there was special syntax to get inputs to appear, hadn't seen that in KM before.

Do you know how to navigate this box with keyboard? I expected Tab to work as in a browser or other app, but that seems not to navigate. Same with shift+tab, or combinations of modifiers+Return that I tried. I haven't found any keyboard accessibility options for navigating the snippet box but I would think allowing Tab to go between fields would be very helpful. For now I'm using "click at found image" on OK to submit the snippet.

I may go back to using the HTML prompt. Although the snippet method is a bit faster to pop up, there's the apparent keyboard accessibility issue, and the font for the textarea is very small, smaller than anything else I've seen in Keyboard Maestro. I read over the instructions for that prompt but didn't see anything about styling.

**Edit: Yes, I've reverted to using the HTML Prompt method for now, at least until I'm aware of a way to style the tiny Snippet textarea font.

It would also be great if either of these dialogs (HTML Prompt or Snippet) could be made to appear in the current screen rather than, as it seems now, always in the main screen.

I haven't had a chance to upgrade to KM11 yet, so I can't test the Snippet action itself, but you could try adding a Set Next Engine Window Position action before the Prompt for Snippet action to see if it can position the dialog.

The Custom HTML Prompt in particular can also be positioned using the data-kmwindow attribute as shown here.

For both of those positioning methods, the SCREEN() functions will come in handy. In your case, it sounds like you'd want to use the Front index mentioned on that page, which will allow you to reference the screen containing (most of) the front window. (Another index option you may like to try is Mouse, which refers to the screen containing the mouse.)

Example: if the dialog you want to position will be 600 px. wide by 400 px. tall, you can place this action before it to make it appear it in the middle of the screen containing your front window:

image

The calculation SCREEN(Front,MidX)-300 means the following:

SCREEN: The SCREEN function.
Front: An index referring to the screen that contains (most of) the front window.
MidX: The horizontal midpoint of the screen being referenced by the Front index.
-300: Subtracting half of the width of the dialog (600 px. in this example) so it will actually be centered.

If you aren't familiar with how to get the dimensions of the dialog you'll be positioning, refer to the KM wiki article about Window Tokens.