Couple Mailmate to Things for Maximum Productivity

Recently, Michael Lopp wrote I Hate Fish in which he outlined his approach to getting work done.

The simplicity to remember when to do what resembles how I use Things (which he also uses) in combination with Mailmate and Keyboard Maestro:

The system also works when I just replied to an email, and I want to be reminded if there has been a follow-up or not.

The core of the system relies on this Keyboard Maestro macro

The Keyboard Maestro macro
The Keyboard Maestro macro

All the heavy lifting is done by this bit of JS:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
let addDays = (days) => {
    let d = new Date();
    d.setDate(d.getDate() + days);
    return d.toISOString().split('T')[0];
};

function createThingsTodo(name, activationDate, notes) {
    let url = "things:///add?";
    let params = [];
    
    if (name) params.push("title=" + encodeURIComponent(String(name)));
    if (activationDate) params.push("when=" + String(activationDate));
    if (notes) params.push("notes=" + encodeURIComponent(String(notes)));
    url += params.join("&");
    
    let app = Application.currentApplication();
    app.includeStandardAdditions = true;
    app.openLocation(url);
}

let d = parseInt(kmvar.Days, 10);

let mailmate = Application("Mailmate");

let message = mailmate.messages[0];
let name = message.name();
let URL = message.messageUrl();
// Usage examples
createThingsTodo(name, addDays(d), URL);

Some notes:

You can download the macro here.