Things Parser for Drafts 5
UPDATE: I’ve just released a version 2.0 of my Drafts Parser with new block-based entry and project creation features. You can read more about the update here.
For example, I wrote a script to automatically add Markdown Links in reference style, complete with clipboard URL detection and automatically incrementing link reference numbers. You can add it to Drafts from the Drafts 5 Action Directory here.
Recently, I was reading Federico Viticci’s article on MacStories about Things automation. The Cultured Code team have recently updated Things with an advanced new URL scheme. In addition to a lot of new URL scheme actions, they added an
add-json command which allows you to import a bunch of tasks or projects into Things with a single URL scheme action: no jumping back and forth between apps with repeated x-callback-URLs. Federico created a workflow which takes the content of the clipboard copied from a text editor, and assembles a chunk of JSON to send to Things. Each line of the text becomes a separate task, with special characters giving additional metadata about each task.
In addition, I wanted my script to support all of the features that the Things
add-json command supports, so as well as the special markup characters for projects, headings, tags, and notes, I’ve added characters for deadlines and checklist items. The full syntax is as follows:
- #Project Name
- @Tag Name
- *Checklist item
As with tag names in Federico’s workflow, multiple checklist items can be entered.
With this Drafts action, I can type multiple lines in the following format, and they are all simultaneously sent to the right place in Things.
Write blog post about Drafts and Things today at 4pm #Writing ==PolyMaths @drafts @things !Friday *drink espresso *write *publish
If you’re a Drafts user and want to use this script, you can only do so if you are on the Drafts 5 beta. If not, the full release of Drafts 5 should be coming soon, so watch out for that.
Of course, it is very simple to create an action that launches Federico’s workflow directly from within Drafts. Drafts has a native “Run Workflow” action step which you can use. ↩