Repeating tasks script


#1

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:


Recurring tasks
TaskPaper Extensions Wiki
Script hooks?
#2

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.


#3

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?


#4

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


#5

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.


#6

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.


#7

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?


#8

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.


#9

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.


#10

@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!


#11

This is awesome! Thank you :man_dancing: