automation

    Fixing Things with Keyboard Maestro

    I can’t help playing with Things sometimes. Even though there are plenty of reasons not to use Things, it’s pretty. It’s my attractive nuisance. However, I can’t stand its inability to complete repeating items before they’re scheduled, so I fixed it.

    You know I like Keyboard Maestro and Shortcuts. I combined them to work around Things’s glaring shortcoming. So can you!

    First, install my Shortcut, Things: Get ID of current selection. Look inside it. It only copies the internal ID of the currently selected item to the clipboard.

    Then, install my Things: Repeat action early Keyboard Maestro macro and set it to trigger with a hotkey you like. Since cmd-K is the using Things shortcut for completing an item, I set mine to trigger when I press shift-cmd-K. Then it takes these steps:

    1. Calls the Shortcut to get the ID of the current Things item.
    2. Goes to the latest completed copy of that item.
    3. Duplicates the completed copy and navigates to the new copy.
    4. Calls the Shortcut to get the ID of the new copy.
    5. Marks that copy as “open”, that is, not completed.
    6. That causes Things to move the copy from the “logged items” section back up to the list of open items, so the macro calls a Things URL to jump back to the re-opened, copied item via its ID that we saved a couple steps ago.
    7. Marks the new copy as deleted. That causes Things to update the repeating task so that its When and/or Deadline dates are relative to today.
    8. Calls the Things URL to jump all the way back to the repeating item, via its ID that we saved in the first step.

    Whew. That’s a handful, huh? But it mostly works!

    Caveats:

    1. There’s no error handling. Keyboard Maestro just blindly sends keyboard presses and menu selections to Things and assumes that everything’s going well.
    2. I’m not really sure what would happen if you run the shortcut with no items selected, or more than 1 item.
    3. If it’s been ages since the last time the item was completed and there’s no longer a “latest” item to go to, I don’t know what happens next.

    In short, use this at your own risk. There are a dozen things it could be doing better or more safely and I haven’t (yet) done any of them. Still, it works! If I squint hard enough and get lucky, the new macro makes Things repeating actions work like every other to-do app in existence. I’m calling that a win.

    Automating this static website

    I use the Hugo website generator to create this website out of a bunch of Markdown fils. A lot has been written about this approach, but the main advantages are that the site can load quickly even when it’s serving a lot of traffic, and you don’t have to worry about bugs in the blog software when there isn’t any. The downside is that you can’t post to it as easily when you’re out and about on a mobile device.

    I wired up a nice little workflow for making it as easy easy to post here with my iPad as to a Wordpress site:

    • I write the blog post in Markdown in the Drafts app.
    • When done, I run an action that triggers a Shortcut which adds it to a Git repo in the Working Copy app, commits it, and pushes it to my Gitea server.
    • A cron job on the web server runs a git pull from Gitea, runs Hugo to generate the site, then copies the output to the web server.

    So the plumbing is a little more complicated than just opening a website form and clicking a “post” button, but from the user’s perspective it’s every bit as simple. iOS and iPadOS are starting to get a nice ecosystem of Unix-style “do one thing and do it well” tools that can be strung together with scripting.