Better Looking (And Multi-Line) Text Input In User Prompt Dialogs?

I've been using KM for several years and am tickled by its functionality.

But, I've also found the input prompts to be kinda ugly. Is there a way to get a better looking, and multi-line, text input box?

How about getting rid of the icon?

2 Likes

Multi-line text input is on the todo list.

In the mean time, use the Custom HTML Prompt action and you can make the window look like anything you want.

The icon and the title of Keyboard Maestro windows help avoiding user confusion and support emails like "I spent four hours trying to figure out what this window was before eventually finding it was some macro I'd forgotten I wrote".

If you want to control the window completely, you can with the Custom HTML Prompt and hopefully then will remember what its purpose it.

4 Likes

How about removing the icon and allowing users to set the title? Then they can see for what they designed the input box. Besides that, Keyboard Maestro User Input isn't very informative, is it?

As I said, β€œThe icon and the title of Keyboard Maestro windows help avoiding user confusion and support emails like "I spent four hours trying to figure out what this window was before eventually finding it was some macro I'd forgotten I wrote".” The title and icon serve the purpose of avoid user confusion which leads to support emails.

I try to avoid support emails as one of my highest priorities, for a number of reasons:

  • Support emails are a waste of user time - if they have to write an email, and then wait for a response, they have wasted minutes of their time and waited typically a day for an answer.
  • Support emails are a waste of my time - if I have to answer support emails, that is time I could be spending improving Keyboard Maestro.

So I spend that time to avoid having to receive the email in the first place. That icon and that name is specifically chosen for this purpose.

If you want more control, there is the Custom HTML Prompt action.

3 Likes

If you don't want to go full "Custom HTML" you can throw up a dialog with an AppleScript action, returning the response to KM:

return text returned of (display dialog "Please Enter a Phone Number:" default answer "000-0000" with title "Phone Number Required")

No multi-line input support, but you can control title, icon, and have up to three named buttons. See "Display Dialog" in the "Standard Additions" AS dictionary for all the options.

2 Likes

No?

property LF : linefeed

return text returned of (display dialog "Please Enter a Phone Number:" default answer LF & LF & LF & LF with title "Phone Number Required")

It's not pretty, but it's there.

:sunglasses:

2 Likes

I think you can do quite a lot better with AppleScriptObjC, but I haven't messed with it.

If interested ask on the Script Debugger Forum

G'ah! I'd completely forgotten that trick... Thanks Chris!

I do keep wondering if you can use SwiftUI in a Swift script. I've a feeling the answer is no, but never get around to learning enough Swift to find out. One day...

1 Like

Very nice! I'll try to find out how I can pass variables to and from this dialogue box. And I guess that it is possible to pass a default answer too?

Wouldn't it be nice to have such a dialogue box as a ready-to-use action? :wink:

1 Like

Hey Hans,

Here's a basic AppleScript that demonstrates how to get and set Keyboard Maestro variables.

NOTE – the KM variable names are text strings – but the AppleScript variables are not.

-Chris

--------------------------------------------------------
property LF : linefeed
--------------------------------------------------------

set kmInstance to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
   
   # Get variable from Keyboard Maestro.
   set asVarName to getvariable "local_copiedText" instance kmInstance
   
   # set Keyboard Maestro variable.
   setvariable "local_KM_VarName" instance kmInstance to dataStr
   
end tell

--------------------------------------------------------

return text returned of (display dialog "Please Enter a Phone Number:" default answer asVarName & LF & LF & LF & LF with title "Phone Number Required")

--------------------------------------------------------
1 Like

No, for the reasons @peternlewis stated above. If you want to create such for yourself then great -- the assumption being that you'd then know all about it, wouldn't be surprised by it, and wouldn't bother Peter with a support ticket!

But don't dismiss icons out of hand, even if the macro will only ever be used by yourself -- they are a very good contextual cue as to why a dialog has suddenly appeared.

Yep -- here's a demo passing in a Local KM variable for the default and returning the entered number to KM for later use:

AS Dialog with Variable.kmmacros (3.4 KB)

Image

4 Likes