Repeating tasks script

Here’s a script for managing repeating / recurring tasks. After running the script, whenever a task with a @repeat value is marked @done, the script immediately duplicates the task and increments the @start and @due dates.

The @repeat value can be:

  • the next date - e.g. Wednesday, June 3, or Nov 26 8:15
  • the next dates, separated by comma - e.g. Monday,Wednesday,Friday
  • a duration offset from the last start/due date - e.g. +6 hours, +3 day, or +1 month

For example:

- repeat next March 20th at 7pm @due(2018-03-15 19:00) @repeat(March 20 7pm)
- repeat every weekday @start(2018-03-20) @repeat(Monday,Tuesday,Wednesday,Thursday,Friday)
- repeat 2 weeks after the start date @start(2018-03-15) @due(2018-03-20) @repeat(+2 weeks)

You can view the full documentation and download the latest version of the script here:

6 Likes

I have to say this is a very nice script. Thank you for your effort in building it. I would have preferred to have it run on demand rather than live as that would pick up items I marked done outside of taskpaper (i.e. taskmator). Still, far better than nothing and very elegant.

This is great! It works after installing in the scripts directory and as I Mark items done, live in Taskpaper.

But I also update the Taskpaper file via iOS sometimes. The script doesn’t seem to update the repeating tasks on launch or by manually triggering the script through the command palette. What an I missing?

Hi @ryanodor. Which iOS app are you using and how did you install/run the script?

I first used a plain text editor to add @done tags. I used 1Writer, but could have also used Drafts, Pythonista, etc. I also tried updating the TaskPaper file via the Taskmator app.

The repeat.scrpt was installed into TaskPaper‘s script directory and launched using the Command Pallete.

The provided file is an AppleScript which I think only works for MacOS. However, if any of those applications support scripts written in Javascript, you may be able to modify the file slightly to get it to work.

Cool. I’ll give that a try.

What about this scenario? Say I have a task that looks like this on the Mac.

- Buy TaskPaper @due(2018-07-13) @repeat(+1 year)

Then, later on iOS, I add @done to the end. The next day I come back to my Mac. I see the updated line which looks like this:

- Buy TaskPaper @due(2018-07-13) @repeat(+1 year) @done

But there is no new task that was supposed to be created by the script. The only way I can trigger it is by applying the @done tag to a task on the fly on the Mac.

Here is another hypothetical. Lets say that I have a file with a bunch of tasks that have @due, @repeat and @done tags already. I open that document, but I have not installed your script yet. So, I install the script and run it. Will it parse the file and create the new repeated tasks or do I have to do something manually?

The only way I can trigger it is by applying the @done tag to a task on the fly on the Mac.

@ryanodor yes, that is correct. Running the script will not repeat tasks that have already been marked @done. Otherwise, a @done task would keep generating a new task each time you ran the repeat script.

What would be the ideal behavior from your perspective? One possibility is to remove the @repeat tag from the @done task after it has been repeated. Then each time you run the script, it could repeat any @done items that still have a @repeat tag.

True. I didn’t think of that.

Maybe the script, when first run, could do a once over pass to check for any tasks marked @done with @repeat(…) task to clean up anything that might have been edited from somewhere else. I like your idea of removing the @repeat(…). You could also change the value in the parenthesis to something like @repeat(complete) or change the entire tag to @repeated. Then those could be ignored on the initial pass. Otherwise I love the current behavior for when I’m working solely in TP.

@ryanodor I just created v2.0.0 with that change and a few other improvements:

  • When you first run the script, it will repeat any @done tasks that have not been repeated yet. Once a task has been repeated, the script will remove the @repeat tag so that it won’t get repeated again.
  • New repeat dates anchor from @start/@due by default. Add @repeat-from-done to repeat from completion date rather than @start/@due date.
  • If there is an @error, the script will add an @error tag rather than overwriting the @repeat value.

Thanks for the feedback!

This is awesome! Thank you :man_dancing:

1 Like

Thank you for writing this script! This is a crucial feature for me.

It’s working for me on launch or when running from the command palette. But when typing “@done” at the end of the task, the following happens:

  • The duplicate task is created (though not immediately visible; collapsing/uncollapsing the list seems to do the trick)
  • When searching, the duplicate task shows up for the correct tags (the expected new start date; no @done tag)
  • However, the text of the duplicate tag displays the old start date and the @done tag
  • On rare occasions, the space between the task title and the first tag will be missing

I’ve played around with the script a bit, and mostly managed to get it to break in a whole bunch of other creative ways (including one state where all explicitly thrown exceptions were suppressed, even with no try/catch… still trying to figure out what was going on with that one).

My guess would be that the task text and the outline aren’t being properly rewritten after all the operations complete. Any suggestions?

Hi, @dannynelson
Do you still have support for this script?
I’m on the latest version of TaskPaper (3.8.17) and would like to implement your script.

I have a series of daily repetitive tasks, like a cheklist. I have already installed your script, downloaded from your repository the latest release 2.0.1.

I have created a task as follows to make it daily, but I get an error.
Task: Test @due(today 17:30) @repeat(tomorrow)
Error: @error(invalid repeat value)

My idea is to have this checklist every day to review my daily tasks.
Are these tasks automatically archived?

I edit after testing:
It worked with Test @due(today) @repeat(+1 day)
It is archived manually and I think it can be a historical record of what has been done.

1 Like