Automatically cancelling duplicate projects in Things
I (try to) run my whole life through Things(3), and I’ve been doing so for many years. Which means I have quite a bunch of recurring tasks and projects. Some of them recur once a year, some of them daily.
The way recurring tasks and projects work in Things31 is that you have a master template, in which you define when it reoccurs, and what tasks are contained in the project. Then, as soon as the moment comes, Things3 will create a new copy of that template.
Which means one of the tricky things with daily recurring projects, is that they can quickly pile up if you didn’t get to finish them. A new copy each day.
For recurring tasks you could easily just switch it to recur upon completion instead of a fixed daily reoccurrence. But for projects I don’t think that’s a good idea. As sometimes it can be that I did do some tasks from the project, but not all of them. In that scenario it’s good to get a fresh copy, which will contain all the tasks again.
So I’ll stick with recurring projects, but sometimes life happens. And the system is no good if we don’t account for life happening.
So what to do if life happens, and I end up with multiple copies of the same project?
I could easily just select it, and CMD(⌘) + Option(⌥) + . to mark it as cancelled. But being reminded of the past failures is not a great feeling. Dealing with these kinds of emotions is part of the fight with procrastination, so it’s probably a good thing to prevent the guilty feelings (even if the guilt is only on the subconscious level).
Thus, let’s automate it.
Initially I tried using Shortcuts, since that’s all the hype. But once again I really just can’t get it to do what I want. It’s too oversimplified for me. Apparently there’s no way to compare time variables2, so I can’t figure out which is the new project and which is the old one.
Then I switched to AppleScript. Even installed Script Debugger to get some actual proper tooling to figure stuff out. But here as well, the frustration got the better of me. In trying to make AppleScript look simple, they’ve actually made it very hard to use. Just give me actual syntax (and proper errors), not mysterious words that could be syntax.
So, Python it is.
In Python there’s a pretty good library for reading Things3 data. And even though I’m not a Python developer, Claude AI is pretty decent3 at it.
For the script to work you’ll need to install the unofficial Things Python API, and make sure you enable Things URLs. Click Manage, to grab your token.
Then take this code, replace the THINGS-TOKEN-HERE
with your actual token, and save it somewhere:
return
return # Return minimum date if no date provided
# First try ISO format
return
# Try standard format
return
return
=
= f
# Use macOS open command to trigger URL scheme
=
# Get all items from Today
=
# Dictionary to store projects: {project_name: [(item, creation_date)]}
=
# Print first item to see structure
# Collect all projects and their creation dates
# Check if item is a project
=
# Try different possible date fields
= or or
=
# Check for duplicates and cancel older ones
# Sort by creation date, newest first
=
# Cancel all but the newest
This code will use the Things Python API library to get all the projects from your Today
view, and iterate through them to figure out if there are duplicates (based on the name). If there are duplicates, it will figure out which one’s the newest, and create a list of all the others. Then, since the library is read only, it will use Things official URL scheme to cancel the old duplicates.
You can run the script using: python3 cancel-duplicates.py
Finally, let’s make sure that the command to run the script is automatically running as well. To automate it, I’ve created a Keyboard Maestro action that triggers every time I wake my laptop.
This process would literally only save me a handful of seconds in time. But according to XKCD I could still get a return on time invested within 5 years or so.
But friction is not only measured in time, it’s also measured in emotion. And being reminded by the stuff you didn’t finish, is bad for your confidence. Which will lead to procrastination, and decreased productivity. So from that perspective, I feel like it’s definitely been worth it.
Did you ever automate anything to save you seconds?