Prompt with Expanding Choice?

I’m trying to figure out how to make Prompt action expand a button choice into a bigger chunk of text. Email action example:

Prompt: Name
Prompt: Email
Prompt: Choice A OR Choice B

However, “Choice A” will the expand in to a longer piece of pre-defined text (A long URL or a greeting message).

So far I can use the button function but it does not really work if the choice contains a long piece of text.

I am trying to see if Drafts can do what Typinator does - present a choice A|B|C and then expand text based on the choice made.

I guess I can figure out how to use Class Prompt but how do I paste the results of the prompt? What is the script?

I’m not sure I totally follow what you are describing, but prompt are static, in the sense that nothing in the interface of the prompt can be changed while the prompt is visible.

If you have long segments of text you need displayed in the prompt to select from, you could use addLabel docs to add the longer texts, and combine that with an addSelect docs which offers the A/B/C choices to specify which passage to select.

We will also be introducing the ability to communicate information from HTML Preview steps back to the app in the next update - which makes it a powerful way to build more advanced dialogs using HTML/CSS/JavaScript that could have dynamic ways to hide/show elements.

Would that work for this:

Prompt window:

"Option A"
"Option B"

If “Option A” is clicked, the pasted text will be a paragraph about story A.

If “Option B” is clicked, the pasted text will be a paragraph about story B.

Found your post while researching something else about prompts and just wondered if the built in “value” object in prompt.addButton might be what you want? Consider something like:

const p = new Prompt()

p.addButton("Option A", "story A")
p.addButton("Option B", "story B")

p.show()

const d = new Draft()

d.content = p.buttonPressed

d.update()

The second parameter in addButton gives you a different value for the button than its label, and the subsequent actions take the value of the button and paste it into a new draft. Hope that helps!

1 Like