Editorial Workflows

Create OmniFocus project

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Create a new OmniFocus project based on a TaskPaper document.

Prompts for a title and date, which are then substitutes where «title» and «due» occur in your document.

The workflow will search for @tags and display a configuration dialog asking which tags to include. If your task includes a @tag, it will only be sent to OmniFocus if you enable it. This allows you to maintain a master template, and filter tasks based on the specifics of your project.

Tasks without any tag will always be included.

Last updated: 2017-01-06
Author: sam@sargeant.net.nz

Shared by: Sam Sargeant

Comments: Comment Feed (RSS)

Filip — 08 Jan 2017
Opens browser instead of OmniFocus… any ideas? What am I doing wrong?
svs — 11 Jan 2017
Try editing the last action in the workflow, "Open URL". Change that to "Default App" and see if that works better?
Filip — 11 Jan 2017
Thanks for leading me in the right direction with your hint. Yes, it works with “Default App”, but only if Safari is the default browser in the Editorial settings (!!). I didn’t get this at first…

+ Add Comment

Workflow Preview
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
Run Python Script ?
Source Code
#coding: utf-8

# Read out all the @tags in the document
# query for title, due date, which tags to filter on
# include all tasks that have no tag
# filter out tasks which have a tag, but have not been selected

# TODO: better filtering of tags for OmniFocus, things that incl parens

import workflow
import dialogs
import re
import ui
import StringIO

all_tags = set()
config_fields = list()

action_in = workflow.get_input()

# Find unique tags
for tag_match in re.finditer(u"@(.+?)\s", action_in):
	tag = tag_match.group(1)
	if tag not in all_tags and '(' not in tag:
		all_tags.add(tag)
		config_fields.append({'type': 'switch', 'title': tag.title(), 'key': tag})		

# display form dialog
metadata = (
	{'title':'Title:', 'type': 'text', 'key': 'title'},
	{'title':'Due Date:', 'type': 'date', 'key': 'due'}
)

config = dialogs.form_dialog("Photo Project Details", 
	sections=(('Project', metadata), ('Tags', config_fields, 'These will act as filters on the tasks so your project is 100% on-point'))
)

config['context'] = True
config['autodone'] = True
config['flagged'] = True
config['parallel'] = True

config['due'] = config['due'].date().isoformat()

# replace placeholders
for key in config:
	action_in = re.sub(u"«" + key + "»", str(config[key]), action_in)

# build our output
template = StringIO.StringIO(action_in)
out = StringIO.StringIO()

for task in template.readlines():
	if re.search(u"@.+?\s", task):
		for tag_match in re.finditer(u"@(.+?)\s", task):
			tag = tag_match.group(1)
			if '(' in tag or config[tag]:
				out.write(task)	
				break
	else:
		out.write(task)

action_out = out.getvalue()
out.close()

workflow.set_output(action_out)
URL Escape ?
Set Variable ?
Variable Name
encodedContent
Value
Input
Open URL ?
Open in
  • In-App Browser
  • Default App / Safari
URL
omnifocus://x-callback-url/paste?target=projects&content=encodedContent
Tab
  • Last-used Tab
  • New Tab
  • Tab with ID:
Unique identifier
Wait until Loaded
OFF
Reveal Browser Automatically
ON