Is it possible to get text input from the user for an action?

I want to run a shell script that sends a message, and I want to specify this message every time I press the button in the touchbar. Basically:

#!/usr/bin/env bash
send-message "$INPUT_FROM_BTT"

I personnally use applescript for opening an console where I can write the input:

set theResponse to display dialog "Enter the comment for task" default answer "R:" with icon note buttons {"Cancel", "Continue"} default button "Continue"

Then you can do whatever you want (including launching shell script with that variable as argument)

1 Like

I was hoping for an interface in the touchbar itself. A textinput in the touchbar will be pretty cool. But yes, this works, too; I don't grok applescript, can you provide an example of using this to run a shell command?

Thanks!

Hi,

I'm new here, but also think that this would be a wonderful feature addition to BTT. If we'd be able to easily prompt for user inputs, one can better do some of the workflows that tools such as Rocket Typist or Keyboard Maestro allow for.

@Andreas_Hegenberg is there a chance for user inputs to be added to the product roadmap of BTT? I know one could do the same with e.g., AppleScript, but it's rather tedious to have to do that each time as opposed to having a pre-built action for it.

I could think of the following examples:

  • text input
  • dropdown input
  • date selector
  • moving cursors across a text template by tapping the "tab" key

Thanks

In general I think for such things the new shortcuts app is much better and BTT can trigger these shortcuts very quickly.

Do you have an example where these would be helpful to have within BTT?

Thanks for the quick reply @Andreas_Hegenberg - btw, BTT has changed my life, I absolutely love it!

Here is a use case:

I've been using Rocket Typist for text expansion, but it's fairly limited as one can't run AppleScript or do more advanced automations. However, I do like the way the app uses drag-and-drop user input prompts. It's really easy to use and quick to set up.

My use case would be:

  1. Trigger shortcut or typed key sequence
  2. Start text expansion
  3. Prompt for user input such as first name, meeting date, topic
  4. Then expand template text with variables populated from input prompt
  5. ....do any additional automations

User prompts could be use in a lot of ways, e.g. text expansion, Slack automation, email automation, file automation, etc.

EDIT:

  • Yes, it would be possible in the macOS shortcuts app, but you would have to jump between apps and call shortcuts from BTT and if you want to use the outcome of an AppleScript in your text expansion (e.g., for checking all your available slots in your Outlook calendar), then I definitely see a great advantage in having this all in BTT.

One additional idea would be to introduce something like input forms. Here's an example from the text expander espanso: