I’ve put together a few of my Keyboard Maestro macros for TaskPaper 3 that I think might have general appeal. I have to thank Rob Trew at the very top of this post, he’s saved me a significant amount of time in figuring out how to automate these apps1.
You can read on to see how they work, or download the bunch as a Macro Library below.
Natural language dates
First, an update to my Natural Language macro specifically for TaskPaper 3. Rather than bundling Sugar.js or relying on other tools, it now just uses TaskPaper’s own DateTime API. A much shorter (and self-contained) script. The macro is set up to trigger via regular expression any time you type a tag with a value, e.g. @due(tomorrow)
. When you close the parenthesis, it will scan the entire task for tag values that will translate to dates and convert them. You can specify which tags it will consider using the “dateTags” variable in the macro, a space separated list of tag names (e.g. due start done
).
You can use language like “tomorrow,” “next tuesday,” “2 weeks” or just “3” to set the date to three days from now. If a string isn’t recognized, it won’t change.
It can also be triggered by a keyboard shortcut, customizable in the macro editor.
The JavaScript it runs is available in a gist, in case you want to pick it apart.
Note, if you’re looking for an update to my scripts for incrementing and decrementing dates, you can take a look at Jesse Grossjean’s JSA version.
Increment/Decrement tags
The increment/decrement macros are used for cycling numeric values in tags like @priority(5)
. You can define the tag and the increment (value to add or subtract) in the macro variables, and create additional macros on different hotkeys to add new tags (and unique values). The library I’ve created for download includes “priority” (1-5) and “completed” (10-100%) macros.
For the @priority macros, the minVal is 1, maxVal is 5, and the increment is +1 or -1.
For @completed, the minVal is 10, maxVal is 100, and the increment is +10 or -10.
When triggered, it will look for the defined tag and add/subtract the defined increment (incValue
). You can set the minValue
and maxValue
variables to define the scale.
If the tag doesn’t exist on the task when the macro runs, it will be added with the minValue (or maxValue if decrementing). If it’s at the top of the scale when you increment (or at the bottom when you decrement), it will be removed entirely. Triggering the macro again starts the cycle over from either direction. Otherwise it just adds/subtracts the defined increment from the current value.
Again, here’s the gist if you’d like just the code.
Download
Keyboard Maestro macros for TaskPaper 3 v1.0.0
Download Keyboard Maestro macros for TaskPaper 3 v1.0.0
A collection of Keyboard Maestro macros for cycling numeric tags, natural language dates, and probably more to come.
Published 02/19/18.
Updated 02/19/18. Changelog
-
I’m still clumsy with JavaScript for Automation. As annoying as I’ve found AppleScript over the years, I’m just not loving JSA much more. ↩