Taming the Prompt on Drafts 4.1.1

This probably should have been 4.2…lots of good new bits.

Greg is spot on here, probably the features I'm the most excited about on the recently updated Drafts are the new prompt action step and the multiple Markdown processors. We'll take a look into those now.

The Prompt

The prompt is a long-waited feature to add direct input into actions, Greg makes one of its use cases clear with an action to save a Markdown note on Evernote that prompts the user for a comma-separated list of tags. What should interest both of us is how these prompts can be built and how information passes to the next action step.

It starts as any other action, you'll find the Prompt step in the Advanced section while creating a new action and it has a lot of options, the following diagram should show you what everything does.

Keep reading for more on a "key" attribute.

I skipped the parameter key because it only affects upcoming steps in an action and is completely customizable. If you leave it as the example, prompt, you have access in the next action to the [[prompt_text]] and [[prompt_button]] template tags, however, you can change the key parameter to anything, if you use llama instead, because you're a trending person, you'd get [[llama_text]] and [[llama_button]] available, where the former is the content from the text field (which is optional) and the latter the selected button, which would be either Ok or Maybe in the example.

The full power of the Prompt step is unleashed in conjunction to Drafts integration to Javascript, allowing you to change the course of a script completely. You can access previously defined tags in a Script step with draft.getTag("tagName"), where tagName is the name of the tag, in our case, either llama_text or llama_button.

I'll show you a quick example on how the Prompt and the Script action steps work well together by reproducing the Search 1Password action from Launch Center Pro. It prompts you with a couple of suggested terms and also an input field in case you want to type your search query.

Search 1Password like a boss from Drafts.

The script checks if you pressed the Search Term button, if so passes the text input to the next step, otherwise it sends the button title.

var pressed = draft.getTag("prompt_button"),
    search;

if (pressed === "Search Term") {
    search = draft.getTag("prompt_text");
} else {
    search = pressed
}

draft.defineTag("input", search);

If you're slightly familiar to Javascript this shouldn't be a problem to you. You can download this action here. Again, this is only an example of what you can achieve with the new Prompt parameter, I think you'll come up with better stuff.

What else?

The number of Markdown syntaxes is equivalent to the territorial dispute in former Yugoslavia, but all you need is probably MultiMarkdown, which is default on Drafts and fantastic to write either a scientific thesis or a blog post.

This also brings us to the new markdown scheme to convert Markdown text to HTML using any of the syntaxes provided by Drafts: MultiMarkdown, Discount or GitHub Flavored.

On a closing note, Drafts now supports sharing to Path, that social network with the coolest share button out there, I can't think of another app that supports it, so its hardcore users must be happy.

Overall, this was a great update for Drafts and I can't wait to see what you come up with the new Prompt action step.