Drafts
February 25, 2013 · View on GitHub
Official Site • iTunes Link: iPad & iPhone
Drafts URL scheme support is Amazing and is a fantastic benchmark to compare other apps' to. Not that this should be a surprise given that Greg Pierce of Agile Tortoise wrote the spec for x-callback-url.
For more ideas and workflows for use with Drafts check out Federico Viticci's MacStories article iOS Automation and Workflows with Drafts. Agile Tortoise also maintains their own Drafts Actions Directory
Table of Contents
- URL Scheme
- Launch Center Pro Actions
- Drafts Actions
- Mr. Reader Services
- Bookmarklets
- Additional Ideas
- Suggested Improvements for Agile Tortoise
URL Scheme
Drafts for iPad
drafts://
x-drafts-for-ipad://
Drafts for iPhone
drafts://
x-drafts://
Create
drafts://
x-callback-url/
create?
text
&action
&x-success
&x-error
Example:
drafts://x-callback-url/create?text=Drafts%20rocks&action=Append%20to%20Scratch
Documentation: Official: Drafts for Developers • handleOpenURL • App Lookup
Launch Center Pro Actions
Clipboard Actions
Create a new Draft with [clipboard]
drafts://x-callback-url/create?text=[clipboard]
Append [clipboard] to Scratch via Drafts
drafts://x-callback-url/create?text=[clipboard]&action=Append%20to%20Scratch
See the Append to Scratch Dropbox Action below.
Prompt Actions
Create a new Draft with [Prompt]
drafts://x-callback-url/create?text=[prompt]
Append [Prompt] to Scratch via Drafts
drafts://x-callback-url/create?text=[prompt]&action=Append%20to%20Scratch
Drafts Actions
Dropbox Actions
Append to Scratch
I keep a Folding Text file named Scratch.ft open on my Mac at all times for quickly copy and pasting text, running timers, creating lists or working with whatever other temporary text is needed at the moment. A lot of people use a workflow like this but may use other filenames and formats and I encourage you to use it as a starting point and to customize it to fit the way you work.
In this case you can change the Predefined File name and extension (Ext) to match your preferred plaintext file such as temp.md, inbox.txt or todo.taskpaper. Customize the location by changing the Path.
Name: Append to Scratch
Path:/Drafts/
File: Predefined:
Scratch
Ext: ft
Write: Append
Template:
---
[[draft]]
[[time_log]]
I like having two line breaks before the horizontal rule before the appended text so appending multiple drafts shows up like this:
Whatever's already in the file. For instance, I leave an Append heading at the end of the file so I can quickly fold everything I've added to the file from Drafts.
# Append
My first draft
February 11, 2013, 10:33:59 AM MST
My second draft
February 12, 2013, 11:45:32 AM MST
This is also easy to change, especially since Drafts will take care of the URL encoding for you.
To install the action copy and paste the following URL into your iOS browser's location bar and hit enter • Help
drafts://x-callback-url/import_action?type=dropbox&name=Append%20to%20Scratch&path=%2FDrafts%2F&filenametype=2&filename=Scratch&ext=ft&writetype=2&template=%0A%0A---%0A%0A%5B%5Bdraft%5D%5D%0A%0A%5B%5Btime_long%5D%5D
Mr. Reader Services
Other App Services
Send to Drafts (Official)
App Name: Drafts
Protocol: drafts:
URL Scheme Template:
drafts://x-calback-url/create?text={[TITLE]
[URL]
[TEXT-SELECTED]}
Visibility:
Standard Menu: On
Text Selection Menu: On
Link Menu: On
Note: This service is built into Mr. Reader. I've included it here for completeness and as an example.
Append to Scratch via Drafts
App Name: Drafts
Protocol: drafts:
URL Scheme Template:
drafts://x-calback-url/create?text={[TITLE]
[URL]
[TEXT-SELECTED]}&action=Append%20to%20Scratch&x-success=mrreader://
Visibility:
Standard Menu: On
Text Selection Menu: On
Link Menu: On
Note: This service is built into Mr. Reader. I've included it here for completeness and as an example.
Bookmarklets
Important Note: Bookmarklets that take advantage of your text selection work differently or don't work at all in different browsers. Please see the guide for further details and workarounds.
Generic
Send to Drafts
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?text=['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected;
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?text=[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected;
Append to Scratch via Drafts
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?'+'text='+'['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected+'&action='+'Append%20to%20Scratch'+'&x-success='+encodeURIComponent(location.href);
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?'
+ 'text=' + '[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected
+ '&action=' + 'Append%20to%20Scratch'
+ '&x-success=' + encodeURIComponent(location.href);
Safari
Append to Scratch via Drafts & Return to Safari
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?'+'text='+'['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected+'&action='+'Append%20to%20Scratch';
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?'
+ 'text=' + '[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected
+ '&action=' + 'Append%20to%20Scratch';
Google Chrome
Append to Scratch via Drafts & Return to Chrome
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?'+'text='+'['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected+'&action='+'Append%20to%20Scratch'+'&x-success='+'googlechrome://';
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?'
+ 'text=' + '[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected
+ '&action=' + 'Append%20to%20Scratch'
+ '&x-success=' + 'googlechrome://';
Dolphin
Append to Scratch via Drafts & Return to Dolphin
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?'+'text='+'['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected+'&action='+'Append%20to%20Scratch'+'&x-success='+'dolphin://';
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?'
+ 'text=' + '[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected
+ '&action=' + 'Append%20to%20Scratch'
+ '&x-success=' + 'dolphin://';
iCab Mobile
Append to Scratch via Drafts & Return to iCab Mobile
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?'+'text='+'['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected+'&action='+'Append%20to%20Scratch'+'&x-success='+'x-icabmobile://';
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?'
+ 'text=' + '[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected
+ '&action=' + 'Append%20to%20Scratch'
+ '&x-success=' + 'x-icabmobile://';
Mercury
Append to Scratch via Drafts & Return to Mercury
javascript:if(window.getSelection()!=''){var%20selected=encodeURIComponent(window.getSelection());var%20selected='%250A%250A%253E%2520'+selected.replace(/%250A/g,'%250A%253E%2520');}else{var%20selected='';}location.href='drafts://x-callback-url/create?'+'text='+'['+encodeURIComponent(document.title)+']('+encodeURIComponent(location.href)+')'+selected+'&action='+'Append%20to%20Scratch'+'&x-success='+'merc://'+encodeURIComponent(location.href);
Expanded:
javascript:
if (window.getSelection() != '') {
var selected = encodeURIComponent(window.getSelection());
var selected = '%250A%250A%253E%2520' + selected.replace(/%250A/g,'%250A%253E%2520');
} else {
var selected='';
}
location.href = 'drafts://x-callback-url/create?'
+ 'text=' + '[' + encodeURIComponent(document.title) + '](' + encodeURIComponent(location.href) + ')' + selected
+ '&action=' + 'Append%20to%20Scratch'
+ '&x-success=' + 'merc://' + encodeURIComponent(location.href);
Additional Ideas
I'm brimming with Drafts ideas, between Drafts flexibility with URL and Dropbox actions and its fantastic x-callback-url implementation the possibilities are endless. This will definitely be one of the most updated app workflows page, stay tuned!
Suggested Improvements for Agile Tortoise
- Drafts isn't Mr. Reader, it isn't URL centric, however, a few URL features would be be awesome for some workflows. Specifically, I'd love to see [[url]] and [[url-without-protocol]] added to the URL actions. Ideally these would find and send the first URL in a draft so — unlike the workflows throughout this project — you wouldn't need place it on the first line to make use of the [[title]]. This would also be great for preventing errors like having a space before or after the URL on the [[title]].
- Taken further, I could see it being cool to be able find and send all of the URLs in a Draft in some kind of array, perhaps in a CSV format. I don't think there's any other app out right now that could take advantage of this but I can think of a few examples where it could be cool:
- Sending multiple links to a bookmarking app like Pinbook for batch bookmarking.
- Sending multiple links to a read later service like Pocket.
- Sending multiple links to an outliner or mind mapping app.