Getting Drafts Right For 2016
If you have numbers to add, where do you go? If you’re like me you probably open a calculator app on your phone. Do you worry about what you need to do with the result?
What about words? Where do you go if you have something to write? I’m sure a lot of people worry about where they want the words to go before they decide how to even start writing. This is a waste of attention. The most important part of writing is the act of writing, not the act of processing. This is why I start almost everything in Drafts for iOS.
Lately, I’ve felt burdened, though. I’ve been too concerned with finding the right action to get my words out of Drafts and to a final destination. I’ve wasted time developing actions without focusing on my intent.
This past holiday vacation I sat with my little friend, Drafts, and whipped it into shape. One of my goals for the season was to lean heavily on tools that make me feel good. Drafts makes me feel powerful and like an astronaut from the future. It’s a joy to use but surprisingly powerful.
Ironically, I rarely use the Drafts app for storing drafts. I prefer to keep draft text in my primary note archive in Dropbox.1 This means that my Drafts app is all about the keyboard and what I do with the words.2
My trick is to not overload Drafts with actions. Now that iOS 9 has terrific sharing sheet options, I don’t need as many actions in Drafts. I prefer to open Drafts and get a giant white canvas over trying to select and edit an address bar in a browser or going through several taps to create a note in another app. I’ve been trained to think of an app-centric world but I think what we really need is an intention-centric world.
General Tips
The majority of my actions in Drafts delete the draft after they run. I just don’t want to manage these little scraps and if they had long term value I probably sent them to my note collection.
You can set a default in the Drafts preferences.
Set the default time for a new draft based on how you use Drafts. One minute works best for me. This is also in the general preferences.
TextExpander seems like a great idea but I always see bugs with capitalization or strange duplication of common words. The first time I have to back track and delete characters, I’ve wiped out all the time TextExpander theoretically saved me. I like TextExpander on my Mac but turn it off in most iOS apps.
You can process multiple documents at once with some Drafts' actions. Select the documents and tap the “Operations” button in the lower right corner.
Keyboard Actions
The Drafts keyboard is pretty standard but the power behind the Drafts custom row keeps me coming back to the app. Many of the custom buttons are simple navigation and editing controls but some of mine are just magical.
From left to right
Key | Function | Description |
---|---|---|
new draft action | Triggers the Drafts shortcut to create a new blank draft | |
Script | Inserts the clipboard at the current selection | |
Undo action | Standard action | |
Redo action | Standard action | |
Move left one character | Standard action | |
Move right one character | Standard action | |
Insert one tab | Standard action | |
Script | Menu of special characters to insert | |
@ | Inserts a character | |
Smart parenthesis and brackets | Starts or finishes a parenthesis set by JavaScript | |
Script and helper action (see below) | Displays popup list to select one of my common tags and inserts it | |
Insert string | Expands a TextExpander shortcut for various date and time stamps. Soon to be replaced by JavaScript in Drafts | |
Script | Inserts the current time stamp | |
Scripts | Inserts Markdown based on selection | |
Script | Sorts lines alphabetically | |
Script | Converts selection to Title Case |
Most of these are straightforward enough. Command actions are easily added by anyone through the basic configuration. The commands are all available with just a few configurations. Script keys are more complex and very powerful. For example, the sort function is a moderately complex bit of JavaScript. I use this function a lot more than I expected. Very often I use Drafts to just do a bit of editing for an email draft. I can send some text into Drafts and then clean it up before heading back to my email app.
Keyboard actions can also launch more complicated Drafts menu actions. One of the benefits of this approach is that I can use prompts. For example, I often insert common tag words in notes but over the years I find it increasingly difficult to remember the genius of my tag system. A prompt gives me a quick reminder, guarantees that I spell it correctly, and provides the convenience of inserting the tag for me.
Creating a keyboard action like this is surprisingly simple. It’s two steps. The first step displays a prompt and saves the selection as a tag. The list of prompt buttons is separated by pipe characters. The Key value is set to prompt to capture the button selected. Behind the scenes, Drafts stores this selection for use in any subsequent step.4
The next step of the action runs the script that does the work. The script has access to the button pressed in the prompt by calling the draft.getTag() function with the name of the tag to retrieve.
:::JavaScript
// sets a variable to the text of the prompt selected
var tag = draft.getTag("prompt_button");
// Get the content of the current draft before we modify it
var text = draft.content;
// get cursor or selection
var selRange = [draft.selectionStart, draft.selectionLength];
// Insert choice at the cursor or replace selected text
draft.content = text.substring(0, selRange[0]) + tag + text.substring(selRange[0] + selRange[1]);
// Save draft changes
commit(draft);
Menu Actions
My menu actions are conduits for words. It’s how I get everything out of Drafts. I don’t use the Drafts archive. I don’t sync my Drafts documents. I write and then do stuff with that writing.
Part of the problem I created for myself was an overwhelming number of conduits. My solution was to cut way back to only the actions I use regularly or that do things that the iOS 9 share sheet doesn’t do. Here are the broad categories my actions pile up in.5
I have a tasks collection which are really just things to capture text to a variety of inboxes. My most dependable action is used to process lines of a draft into TaskPaper items and then prepend those into my TaskPaper file on Dropbox.
Here’s the JavaScript for processing the lines and creating tasks or projects as required.
:::JavaScript
// Handle multiple line breaks
function removeBlanks(txt){
txt = txt.replace(/(\r\n|\r|\n)+/g, '$1')
return txt;
}
//## Prefix each line as a task
function textPrefix(textStr, preFix){
var i= 0;
var array1 = textStr.split("\n");
re = /^\t{1,}/;
for ( i = 0; i < array1.length; i++) {
if (array1[i] !== ""){
taskString = array1[i];
var tabPrefix = "";
var tabMatches = re.exec(taskString);
if (tabMatches){
tabPrefix = tabMatches[0];
taskString = taskString.replace(/^\t{1,}/, '')
}
var projMatches = removeBlanks(array1[i]).match(/:$/);
if (projMatches == null){
array1[i] = tabPrefix + preFix + taskString;
} else{
array1[i] = tabPrefix + taskString;
}
}
}
val = array1.join("\n");
return val;
}
var sel = draft.content;
draft.content = (textPrefix(removeBlanks(sel), "- "));
commit(draft);
Along with actions to append to my task file, I also love the option to quickly write a calendar item in Drafts and then have Fantastical instantly convert that to a box of attention in my calendar. My Fantastical action shows a prompt to select the calendar first and then inserts the results in the URL for Fantastical. This is what computers are for.
The URL scheme for Fantastical is clever enough to set the calendar for the event.
:::HTML
fantastical2://x-callback-url/parse/?sentence=%20[[line|1]]%20%2f[[prompt_button]]&x-source=Drafts&x-success=drafts4%3A%2F%2F&x-cancel=drafts4%3A%2F%2F
I also strongly recommend everyone keep a work journal. I use mine to track my accomplishments and what I’m working on. It’s more of an achievement list rather than a task list. My work journal action appends the draft text with a timestamp to a file in Dropbox. It’s an easy way to leave myself a breadcrumb trail but also to document major accomplishments for the end for the year review.
Next up is my “outbox” where I have a few generic actions to send text outside of Drafts. My most used actions are “Copy to Clipboard” and “Share.” The Share action opens the iOS 9 share sheet which gives me access to a lot of other apps and services without cluttering Drafts.
My communication collection is pretty basic. I tweet and compose emails in Drafts 90% of the time. It’s a good way to limit opportunities for grazing. I also have a few pre-configured text message groups to make it easy to jump in and send a quick message.
My next three action groups might be a bit unusual.
The tiny text boxes in most browsers are not where I want to start my web searches. I want a nice big window in an application that feels like it was made for text. That’s why I use Drafts URL actions to do my searches. So, if I want to know what a “cavy” is, I open Drafts and fire the question off to iCab.
Searching in iCab is a simple URL that sends the current Draft into the best alternative browser for iOS:
:::HTML
x-icabmobile://x-callback-url/search?searchTerm=[[draft]]
Here’s how I open almost all of my 1Password bookmarks. I type in Drafts and then trigger this URL action:
:::HTML
onepassword://search/[[draft]]
I also search my Pinboard collection a lot and my favorite app for that is still Pinswift. But I didn’t want a bunch of different actions for all of the different ways I search.6 Instead, I created an action that offers a choice and then builds the URL scheme that fits the choice.
The JavaScript builds the URLs for the next action to launch by appending the appropriate tags.
:::JavaScript
tag = draft.getTag("prompt_button");
if (tag === "Public") {
draft.defineTag("search", "pinswift:///search/?query="); }
if (tag === "Network") {
draft.defineTag("search", "pinswift:///search/network?query="); }
if (tag === "Full Text") {
draft.defineTag("search", "pinswift:///search/?fulltext=on&query="); }
I definitely prefer the approach of a single action with a prompt. It cuts down on the number of actions cluttering Drafts and reduces how much I need to think about my next steps.
My capture collection is all about offloading ideas for later. I use iThoughts for iOS a lot so of course I have an action to take a draft and append it to an iThoughts map. Here’s the URL scheme for that:
:::HTML
ithoughts://x-callback-url/amendMap?path=/My%20Maps/Capture&target=Inbox&text=[[draft]]¬e=[[date|%Y-%m-%d_%H%M%S]]&edit=no&x-success=x-drafts4://x-callback-url/create
When I hear of a movie or book I need to spend time with, I write it in Drafts and then append it to a Dropbox note. This is what Drafts was meant for. The notes are in Taskpaper format, which is just perfect for me. I can open them in Editorial for iOS, TaskPaper for Mac, or even Sublime Text to check them off and archive.
The files are named things like “Books @list.taskpaper” or “Movies To Watch @list.taskpaper” to make it easy to find them no matter which app I use. Every file with the @list tag in the title is something to do with list tracking, like gift ideas or apps to buy.7
The “Add to Notes” action creates a note in Dropbox with the timestamp as the title. Nothing special but really handy.
The “Note in 1Writer” action is a URL to launch 1Writer for iOS, create a new note with a timestamp as a title and then return to Drafts when it’s finished. It’s no better than the Dropbox action but it’s an experiment in URL schemes for 1Writer.
:::HTML
onewriter://x-callback-url/create?type=Dropbox&path=Notes&name={{[[title]]}}&text={{Title: [[title]]
Date: [[date|%Y-%m-%d %H:%M:%S]]
[[body]]}}&x-success={{drafts4://}}
The last action uses the Copied iOS app to sync a bit of text back to my Mac. If you’re not using Copied, it’s a top pick for me. It works great and closes a lot of gaps when working with iOS and a Mac.
:::HTML
copied://x-callback-url/save?title=[[date|%Y-%m-%d %H:%M:%S]]&text=[[draft]]&x-success={{drafts4://}}
Front Line
Drafts has graduated to my primary springboard in iOS. It’s right there where Editorial used to be. I use it constantly.
The Drafts app for Apple Watch is the only app other than PCalc that consistently works for me. More importantly, the Drafts app actually makes the Apple Watch feel like something from the future. I can dictate a new note without ever taking my phone out of my pocket.
The notes dictated from my Apple Watch are routed to the Drafts inbox for processing later. It’s a convenient input method but it’s not ideal for someone like me that doesn’t really use the Drafts inbox on a regular basis.
What’s Missing
Nothing is perfect but I think I have a long future with the Drafts app. I’ve used it for years and it’s steadily improved with every release. I still wish it offered some alternatives for document syncing that will keep me in my larger note collection. I’d love a Dropbox option or even WebDAV.
The Watch app is terrific for input but often I dictate with my watch and soon after pull out my phone to take an action on a note. I’d love some more functionality to immediately process a note but I’m also wary of asking for too much and making the watch app slow to launch.
The filters in Drafts are a really nice option but only work on the Draft text or the flag status. I’d like the option to create custom tags for use with the filters without needing to put meta data in the document text.
Apps Mentioned
References
Users of Drafts tend to be huge fans. Fortunately, some of them are also huge nerds and nice people that like to show their work.
-
I wish I didn’t have to use Dropbox but it’s still the only way to sync text between every major app I use. ↩︎
-
1Writer can be configured to behave somewhat like Drafts but I find Drafts to be faster and more convenient in almost every way. 1Writer is still a great iOS app though. ↩︎
-
Did you know you can slide on the bottom of the action menu to switch tabs? Crazy. ↩︎
-
There’s a nice tutorial over on the Drafts Web site. ↩︎
-
Emoji for collection names are a lot more compact that written words. These are readable and I don’t have to scroll to find a collection.3 ↩︎
-
Pinswift provides general private search, network search and full text searching options. I use them all. ↩︎
-
This may not stay in taskpaper files forever. I really like the options I get when I store lists in iThoughts. I also name the iThoughts file with the “@list” tag. It’s an ongoing experiment but I’ve used this text files for at least 10 years. ↩︎