Using URL+Drafts to enter a list with context

I visit an outside jobsite weekly, and when I arrive, I am bombarded with capture items that must be resolved before I leave that day.

Is there a way I can use Drafts (or other iOS apps) and OmniFocus to capture lists of tasks that would be automatically added to the same project and context in OF? I know I can use Drafts to capture to the Reminders list, but this can’t automatically set Project and Context. I want to type in a list of tasks, push a button, and have all the tasks made into individual action items in the same project/context in OF.

What’s the best way of doing this?

No suggestions at all?

I need to make a list in Drafts like:

Talk to Bob re water heater
Repair printer
Sign QA reports
Take photos of water damage
Call Nora for estimated finish date

And push a button, and have them all imported into OmniFocus, with the same project,context, flag, defer and due.

I would suspect there’s a way to do this with javascript, and turn it into a TaskPaper list that can be pasted into OF2. I have no idea how to construct it.

A little help, please.

There is a Drafts action for this that I use, and it can be found here. Note that it uses Reminders as a proxy, but the benefit is that you don’t leave Drafts.

This pre-dates the iOS automation that OF added by quite a while, so I’m sure it could probably be updated and written with x-callback, but I care more about the end result than the vehicle, so… :)

EDIT: This just dumps to inbox, and doesn’t set metadata like project, due/defer date, etc. I’d be more inclined to use Workflow for that than Drafts, but that’s just because I know Workflow better than I know Drafts.

Hope that helps!


Thanks for the help. I use the Drafts - Reminders - Inbox action, but I’d like to set all the actions in the list to the same project, context, defer, due and flag.

How would you do this in Workflow? I have the app, but haven’t been putting it to use.

Hehe and I whipped up this one, too.

The gotcha is that the Project and Context have to exist in OF in order for this to add to them (i.e. it won’t create a new Project or Context).

I suspect that a more glamourous approach might be to parse it (or even write it) in to Taskpaper format, then paste it to OF.

Here is a Drafts-only approach using javascript and the OmniFocus URL scheme.

To use, your drafts note should be structured like so:

Project Name
Defer Date
Due Date
Task 1
Task 2
Task 3

For this example, I have hard-coded the script to automatically add a flag to all tasks. Also, context is omitted since it is assumed that the context will inherit the properties of the project. Be sure not skip any of the first three lines - otherwise, the code won’t work.

Also, here is the javascript code for anyone who is interested in learning or adapting for their own use.

// Project
// Defer Date
// Due Date
// Task List

// Context assigned automatically with project
// Flag automatically assigned

var content = draft.content;

var lines = content.split(/\r\n|\r|\n/g);

var project = lines[0];
var deferdate = lines[1];
var duedate = lines[2];

var tasklist = “”;

for (var i=0; i< lines.length; i++) {
if (i>2 && lines[i]!= “”) {
tasklist = tasklist.concat("-",lines[i]," @flagged @due(",duedate,") @defer(",deferdate,")","\n");

project = encodeURI(project);
tasklist = encodeURI(tasklist);

var fullUrl = “”;

fullUrl = fullUrl.concat(“omnifocus://x-callback-url/paste?target=/task/”,project,"&content=",tasklist,"&x-success=drafts4:///");

draft.defineTag(“full_url”, fullUrl);

1 Like

Thanks very much for all your help!