Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

395 lines (268 sloc) 14.837 kb

Drafts

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

  1. URL Scheme
  2. Launch Center Pro Actions
    1. Clipboard Actions
    2. Prompt Actions
  3. Drafts Actions
    1. Dropbox Actions
  4. Mr. Reader Services
    1. Other App Services
  5. Bookmarklets
    1. Generic
    2. Google Chrome
    3. Dolphin
    4. iCab Mobile
    5. Mercury
  6. Additional Ideas
  7. 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 DevelopershandleOpenURLApp Lookup

Table of Contents ↩


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

Table of Contents ↩


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

Table of Contents ↩


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.

Download ServiceHelp

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.

Download ServiceHelp

Table of Contents ↩


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);

Table of Contents ↩


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!

Table of Contents ↩


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:
    1. Sending multiple links to a bookmarking app like Pinbook for batch bookmarking.
    2. Sending multiple links to a read later service like Pocket.
    3. Sending multiple links to an outliner or mind mapping app.

Table of Contents ↩

Jump to Line
Something went wrong with that request. Please try again.