TIP: iOS 13 Shortcuts Examples

iOS 13 offers some significant upgrades to Apple’s Shortcuts app. You can find out a lot of details about these upgrades in the MacStories iOS 13 Review Shortcuts section. Most importantly for Drafts, third party apps can now create actions that appear in the Shortcuts app which can receive and return data in the form of parameters. This unlocks a lot of possibilities.

Drafts 15 introduces a wide array of Shortcuts actions which support parameters and allow you to work with Drafts data. Shortcuts can create, update, append or prepend to drafts - including abilities to set tags, flagged status, and move drafts between folders - all without ever opening Drafts.

Even better, Shortcuts can get information out of Drafts. Queries can be run which load drafts in a workspace, or just return drafts matching arbitrary searches. A full list of Shortcuts actions is currently available in the Drafts User Guide automation section.

To get you started playing with these new powerful capabilities, we are posting a couple of simple examples that might be useful out of the box, or serve as starting points. Important to note that many Shortcuts integration actions require Drafts Pro.

Installation Note: To use these Shortcuts, you must be running iOS 13 or greater, and Drafts 15.0 or greater. To install example Shortcuts from the links below, you must enable “Allow Untrusted Shortcuts” in iOS Settings > Shortcuts.

Example: Open Last Modified Draft

The “Open Last Modified Draft” shortcut opens drafts to the most recently modified draft in your draft list.

Install Example Shortcut: Open Last Modified Draft

How It Works:

This shortcut consists of three steps, configured as follows:

  • Search Drafts: This action searches your inbox folder, sorted by modified date descending so the most recent drafts are first. It also sets the “Limit” parameter to 1 to tell Drafts to only return the one most recent Draft we are interested it.
  • Get Item From List: This step gets the first item from the list of Drafts returned.
  • Open Draft: Opens drafts to the selected draft.

Example: Workspace Summary

A longer example, this action prompts you to select one of the Workspaces you have configured in Drafts, then queries for all the drafts currently in the inbox of that Workspace. It then displays a summary of those drafts, including their title, and character and word counts.

Install Example Shortcut: Workspace Summary

How It Works:

  • Text / Set variable ContentSummary: These steps setup a template text to use to build the Markdown summary.
  • Get Drafts from Workspace: Prompt for a Workspace using the “Ask Each Time” option, and get the inbox drafts from this Workspace.
  • Repeat with each: Loop over each of the drafts found in the previous action.
    • Count Words in Content / Set variable: Counts the words in the content property of the current draft and store that in the WordCount variable.
    • Count Characters in Content / Set variable: Counts the characters in the content property of the current draft and store that in the CharCount variable.
    • Text / Add to variable ContentSummary: Create a text combining the title of the draft with the calculated word and character counts created in the previous actions, then add that text to the ContentSummary variable created at the beginning of the shortcut.
  • Count Items in Drafts: Count the number of drafts returned by the Get Drafts action
  • Text / **Set variable Text: Create a text combining the ContentSummary and Count values in one template and assign it to the Text variable.
  • **Make rich text from Text: Convert the Text we created in Markdown format to Rich Text.
  • Show in Quick Look: Opens a preview window displaying the result.

Conclusion

We hope you enjoy experimenting with the new Shortcuts integration capabilities of Drafts on iOS 13. Please let us know about additional actions you would like to have in Drafts. Release 15 is just a first pass at this functionality and I’m sure we’ll be adding more actions based on your feedback in updates soon!

4 Likes

Very nice. Installed and will promote them to the top of my Today view on iPad OS 13 home page.

Is it possible to create a shortcut that creates a new Draft with filled in tags and content and then opens that draft in Drafts for editing? I was trying to do this last night but couldn’t get the second part working.

1 Like

It should be, but it appears there’s a bug in the Create Draft shortcut action that is not allowing the resulting new draft to be selected in subsequent steps. This will be fixed in the 15.1 update.

2 Likes

Does it have to start in Shortcuts?

I’m starting in Drafts with my “Create Daily Draft” Action. My draft gets tagged and then goes to Shortcuts for my calendar. (It also refreshes my TextExpander snippets.)

2 Likes

Oh that sounds like an interesting workflow - is that shareable?

It’s in multiple pieces - one in Drafts and one in Shortcuts.