Drafts 19

A new version of Drafts hit the App Store (iOS and Mac) yesterday. There are some decent improvements on the iOS side, but the big changes are on the Mac side.

For both platforms, there is the addition of Quick Search. This is a way to search for text across all your drafts, actions, and workspaces. You invoke it by pressing the circled magnifying glass in the bottom right corner (an area that’s typically covered up by the action bar when you’re typing) or by typing ⇧⌘F if you’re working at a keyboard.

Quick Search button in Drafts

That brings up an overlay window in which you type the text to search for. Workspaces with that text appear at the top; actions with that text are below that; drafts with that text (including in their tags) are listed at the bottom.

Quick Search results

The found workspaces and actions scroll horizontally; the found drafts scroll vertically. It’s a nice feature, especially if you haven’t been diligent about tagging your drafts. And unlike the search feature in the drafts list, shown below, Quick Search will search across all your drafts, not just those in the current list (Inbox, Archive, etc.).

Drafts list search button

Quick Search requires iOS 13 or macOS 10.15 (Catalina), so right now I can only use it on my iPads and iPhone.

The more important news—to me, anyway—is the addition of AppleScript and shell scripting features to the Mac version. There are two parts to the AppleScript support:

  1. The ability to run AppleScript from within Drafts through either the Run AppleScript action or the AppleScript class added to the Drafts JavaScript library.
  2. The ability to control Drafts from AppleScript. This is currently rudimentary—the only command is make new draft—but improvements are planned for future releases. And frankly, being able to create a new draft is probably the command you’d use the most.

As for shell scripting, that really means any kind of Unix scripting: bash, zsh, Perl, Python, Ruby—whatever scripting languages you have on your Mac and can invoke through a shebang line. Shell scripts are run through the new ShellScript class in the Drafts JavaScript library.

If you read the aforelinked docs, you’ll see that AppleScripting and shell scripting in Drafts consists of writing JavaScript that includes a string variable with all of the AppleScript or shell script code in it. Like this:

bash:
let script = `#!/bin/bash
echo $PATH`;

let runner = ShellScript.create(script);
runner.execute();
alert(runner.standardOutput);

That may seem a little weird to you, but I’ve been doing something similar with AppleScript in Python for years, and you get used to the context shifting pretty quickly.

Until now, I’ve used Drafts on the Mac almost exclusively as a means of getting stuff I’d written on my iPhone or iPad into BBEdit. But now that Drafts is extending its reach out into the Mac—and allowing the Mac some preliminary control over it—I’m thinking I could get a lot more use out of it.