Things Parser 2.0

Just published version 2.0 of my Things Parser.

Action Directory link: http://actions.getdrafts.com/a/1DV

More info below:

Things Parser

Intro

This script action sends each line of the draft to Things 3. Special characters can be added to each line (after the task name) to create additional metadata about the task.

The syntax is as follows:

  • #Project Name
  • @Tag Name
  • ==Heading
  • //Task note
  • !Natural Language Deadline String
  • *Checklist Item

Each of these markup characters should be immediately preceded by a space. The task name must come first in the line. The date and time of the event can be written in natural language anywhere in the line, and does not require a special character. The script also automatically detects whether or not a time has been written. If a date and time are written, it adds a task with that date and a reminder at that time. If only a date is written, it doesn’t add a reminder.

Multiple tags and checklist items can be entered.

Special characters can be used elsewhere in the line, as long as they are not immediately preceded by a space, so for example the following is fine.

//Note containing email address: me@domain.com

is perfectly fine.

Examples:

Task name

Adds item to Inbox

Task name on Wednesday

Adds item to Upcoming with Wednesday as date

Task name on Wednesday at 6pm

Adds item to Upcoming with Wednesday as date and a reminder at 6pm

Task name on Wednesday at 6pm !Friday

Same as above with a deadline of Friday

Task name on Wednesday at 6pm #Project Name ==Heading @Tag 1 @Tag 2 ++Additional Note !Friday *first thing *second thing *third thing

Adds item to project called Project Name under Heading with date of Wednesday, reminder at 6pm, two tags Tag 1 and Tag 2, an additional note Additional Note, and a checklist with the following three items:

  • first thing
  • second thing
  • third thing

Block-Based Entry

To save time in entering metadata, if the first line of a block of text contains only metadata, this will be inherited by every other line in that block. So instead of writing:

task 1 today
task 2 today
task 3 today

you can simply write:

Today
task 1
task 2
task 3

This works with all possible metadata:

today at 5pm !Friday #Project ==Heading @Tag 1 @Tag 2 *checklist item 1 *checklist item 2 //note
task 1
task 2
task 3

If a task has metadata that conflicts with the block heading, the task’s metadata wins, but it will still inherit anything that doesn’t conflict. So things like this are fine:

#Project !Friday
Task 1
Task 2 !Monday
Task 3

Task 2 will be added to Project but will have a different deadline to the other tasks.

Multiple blocks can be entered within a single draft and should be separated by a blank line.

New Project Creation

Using the syntax +Project you can create a new project and add tasks to it. It works in two different modes: in-line and block-based.

In-Line

With the in-line mode you can just add +Project to the end of any line and it will create a new project with that task as the only entry. Headings can also be created, and an area can be specified. Any other metadata is assigned to the task:

task +Project ==Heading #Area today at 5pm !Friday

This creates a project called Project in Area with a heading and a single task under that heading. The task is assigned to today, has a reminder for 5pm, and has a deadline of Friday.

Block-Based

Block-based mode works in similar way with a couple of small changes: all metadata on the block heading is inherited by the new project, not the tasks, and multiple headings can be specified. Metadata must be specified for each task individually. If a task is given one of the headings specified in the block heading, it will be put under that heading, otherwise it will be assigned to the project with no heading.

+Project today at 5pm ==Heading 1 ==Heading 2 #Area @tag
Task with no heading
Task under heading 1 ==Heading 1
Task under heading 2 ==Heading 2

In this case, the date and tag will be added to the project, not the tasks.

It is possible to combine the project creation feature with the block-based task metadata inheritance using two blocks, one which creates the new project, and then another which adds tasks under it. So for example, if I wanted to create an important work project due on Friday with three tasks I wanted to work on today, I could do the following:

+Project #Work !Friday @Important

today #Project
task 1
task 2
task 3
10 Likes

Holy smokes, this is absolutely fantastic!

1 Like

Ok I have a question. I want to create a project with multi line notes before any tasks. How would I do that?

1 Like

I really like this and have been looking forward to incorporating it into my workflow. Thanks for the update and the great write up.

Multi line notes aren’t supported unfortunately

@pdavisonreiber this is a great action! It seems like if a date isn’t selected it defaults to today? Is that intended? Is there a way to disable this feature? I don’t use due dates for my tasks,

Thank you

It should go to the inbox by default. Do you have a sample task that you were entering? Perhaps it is misinterpreting something you wrote as a date.

Here are my tasks.

Here is how it looks in things…

I notice that if I change the header to “this_week” it works as expected. Is there a way around this or do I have to find another title for my headers?

Ah, it’s the spaces. Don’t put spaces in front of any of your delimiters. It will kind of work sometimes, but not consistently. So @weekly instead of @ weekly and the same for all the other symbols. What’s happening at the moment is that the script is seeing the “This Week”, not seeing the == because of the space, and interpreting it as a date.

Great. I will give it a try. Thank you for the quick response

This is brilliant and I can’t wait to dive in. Quick question - is there any way to have it had something to an existing project rather than creating a new one? Many thanks!!!

Yes that is the default behaviour. You have to specifically use the symbol + to create new projects. See http://actions.getdrafts.com/a/1DV for complete documentation.

1 Like

Hi again. I just tried this again without the spaces before the delimiters. using “This week” for the heading is still causing issues. When I change it to “This_week” the issue is resolved. Does the parser stop at the end of a word? Any options here, such as requiring parser to look for the heading title in quotes?

Just tried this again with a different heading name “Current Focus” and the parser worked as expected. So it doesn’t seem having a space in the header name is the issue. I wonder if its because there is a time based word in the other header I was using (i.e. This week)?

Yes, I think that’s it. The parser first looks for any dates in the string, and it is picking up your heading as a date. I need to adjust it to ignore dates that have delimiters immediately preceding them. It does currently do that with deadlines, but not the other kinds of fields. I’ll see if I can get that fixed sometime soon.

Thanks. I appreciate you looking into. Could you let me know when you get a chance to update this action so I can download it again? Thanks again

Thank you for this @pdavisonreiber. This is fantastic and put me over the edge on getting into Things.

Is there a way to block enter items under a heading? I tried and it didn’t seem to work, I have to add ==heading after each task.

Cheers

Is it not possible to add more headers to a project once it’s created?

If I run this:
+test ==header

It works as expected. If I then run this;

#test ==header 2

I get nothing. I tried it with spaces after the ==header and without. With follow up tasks and without. Can’t seem to get it working.

Thanks again

No, that’s not possible unfortunately. The script would need to know the ID of the project after it had been created in order to update it, which Things doesn’t allow. The user can manually get this ID from the Things app, but as far as I know you can’t do this programmatically.