Natural language dates anywhere with Keyboard Maestro
Updated: if you experienced a JavaScript compiler error Error on line 13605: SyntaxError: Unexpected token '='.
, download the 1.0.1 version below.
I’ve been learning to put my just-for-fun coding projects off until the weekend. (You know, so I can work on apps that actually make money.) This weekend’s project was spawned by my finally starting to play around with Keyboard Maestro, and the discovery that you can use regular expressions to trigger macros.
While I generally use TextExpander to trigger my “Make A Date” routines and input the natural language date in a fill-in popup, I was curious about the possibility of just typing delimiters and having the text between processed inline. Thus, “Make a Date for Keyboard Maestro” was born.
Quick example to pique your interest:
In any app, while I’m typing I can use >>
to start a date string for conversion, and end it with <
. Typing >>tom 3p<
will output “2016-11-13 3:00pm.” Or get an ISO timestamp with >>i now<
: “Sat Nov 12 2016 3:52 PM.” I can even create unix timestamps quickly using >>u yesterday 5pm<
: 1478905200. There’s so much more I’ll never remember it beyond what I use often, but I did write it all down…
The script behind the macro is written in JavaScript and uses Sugar.js for the language processing. As per my usual, I went way too far with customizing and handling edge cases. You can see all of the documentation on the project page.
I know this is of limited use to most people, but if you like it, feel free to donate!
Make A Date for Keyboard Maestro v1.0.1
Download Make A Date for Keyboard Maestro v1.0.1
A Keyboard Maestro macro that expands a date using natural language
Published 11/12/16.
Updated 11/17/16. Changelog