Drafts to OmniFocus: add tasks to existing projects

Hi all.
I have some standard projects in OF like
In my Work Folder

  • Work follow up (project 1)
  • External follow up (project 2)
    In my Personal Folder
    Errands (project 1) …

I want to do a brain dump in Drafts and share it into OF3 (pro) and have it automatically add each task under its relevant project.
I guess using Task paper format in Drafts? I’ve learned this format;

Work follow up:

  • task one @tags(stuff)

I’ve tried Rosemary Orchards plugin but couldn’t get it to parse.
I’m really, really not a programmer and haven’t a clue how to make this work. Can any of you kind folks help me?

1 Like

Hi – not sure I understand exactly what you’re trying to achieve but in general terms the syntax for using Rosemary’s plugin to pass Taskpaper formatted text from Drafts to a specific project in OF is

- Task name @project(ExistingProjectName)

(note the leading hyphen)

Further info at Omnifocus TaskPaper reference guide

You can also create a nested task with subtasks by ending the main task with a colon

Main task @project(Project name):
- Subtask 1 @defer(Sunday)
- Subtask 2 @context(Office)

Thank you for responding. I’m trying to create a template in Drafts that I can use to write out task’s and then have them automatically filed under their corresponding project in OF.
For example, anything I enter into drafts under ‘Admin’ would be sent to the existing ‘Admin’ project in OF.
Make sense?

Have you tried

- Task1 @project(Admin) @context(Office)
- Task2 @project(Admin) @context(Home) 


(AFAIK the use of the @context() dates to v2 and earlier versions of OF — they’re now handled as conventional task tags)

Check out Transport Text Parsing

Perhaps a Draft action could execute the contents of a Draft as Transport Text which would automatically create the tasks, even in an existing project?

Here’s the Drafts action script for executing the contents of a Draft as Transport Text to be parsed to created new tasks:

(() => {
	// wrapping the action script in a self-invoking anonymous arrow function (() => {})(); 
	// prevents possible conflicts between script actions that may use the same variable names
	// OmniFocus JavaScript Context
	// Omni Automation script as a function with text input
	function executeTransportTextString(transportString){
		newTasks = Task.byParsingTransportText(transportString, null)
		taskID = newTasks[0].id.primaryKey
		URL.fromString("omnifocus:///task/" + taskID).open()

	// Host Application JavaScript Context (1Writer, Drafts, etc.)
	const transportString = editor.getText();
	// create and execute an Omni Automation script URL
	const functionString = executeTransportTextString.toString();
	const encodedFunction = encodeURIComponent(functionString);
	const inputString = JSON.stringify(transportString);
	const encodedInput = encodeURIComponent(inputString);

	const op = "%28" // open paren
	const cp = "%29" // close paren
	const scriptURL = `omnifocus://localhost/omnijs-run?script=${op}${encodedFunction}${cp}${op}argument${cp}&arg=${encodedInput}`;

The first run wil require approval in OmniFocus. Select the checkbox in the approval dialog to run subsequent executions without re-approval.

Here are the syntax rules for the task-creation shorthand:

  • The first line and any other lines starting with – (double-hyphens) become new actions. Other lines become notes for the preceding action.
  • To specify a project, use > (greater-than sign) or :: (double-colons), followed by a project name or abbreviation. The colons are nicer for the iPhone because they are on the first shifted keyboard rather than the less-accessible math keyboard. The project string is matched exactly as if it was entered in a project cell in OmniFocus.
  • To specify a tag, use @ (at sign), followed by a tag name or abbreviation. Like project names, the context name is matched exactly as it would be in OmniFocus.
  • To enter start or due dates, use # (number sign), followed by some date expression (like 9-30-2014). If there is only one date, it becomes the due date. If there are two (each with its own number sign), the first becomes the start date and the second becomes the due date.
  • To enter a time estimate, use $ (dollar sign—time is money) followed by some duration expression (like 5m, 1h, and so on); you can use the same duration expressions that you use in OmniFocus.
  • To flag the action, use ! (exclamation point) at the end of the action title.
  • You can also add a note on the same line as an action title by separating them with // (double-slashes). Anything after the double-slashes becomes a note, but double-slashes in a URL like omnigroup.com don’t count.

For eample:

New Task!::Existing Project Title #12/12/23 8.30a $3h @existing-tag-name//This is the task note

1 Like

Wow thank you @Sal I’m honored!! I will try it out

@ Sal thank you again. I’ve been playing around with it but have not succeeded in creating a list of tasks that are parsing into individual actions with or without the project name.

For example:
– the action is here ::Work Follow up Actions
– The most powerful ::Admin
This will put the first line in the correct project but the second line is pasted as a note for the first item.

I’ve tried all sorts of combinations but they ask have the same result. Interestingly, the leading dashes are pasted in front of the task.
What am I doing wrong?
Thanks again

I figured it out! I changed the script to
Task.byParsingTransportText(transportString, null) And it all works- yeah!!

D’oh! Right! I had the “single task” paramter of the function set to: “true” when it should have been: “null”

Good sleuthing!

1 Like