Script that add/amend/remove tags to "@dueTomorrow", "@dueToday" and "@pastDue" items when the due tag/date match "@due(yyyy-mm-dd)" format


dueRefresh” script file and KM macro available in this Github repo => Inspired by this script

This script add/amend/remove “@dueTomorrow”, “@dueToday” and “@pastDue” tags to items when @due tag/date match “@due(yyyy-mm-dd)” format.

##Script File & KM Macro

  1. This Github repo contains the script file and a Keyboard Maestro macro that triggers on Taskpaper window open or focus. Look for the scripts > dueRefresh directory.
  2. It works well when immediately chained in Keyboard Maestro to this script that convert informal dates to “yyyy-mm-dd” ISO date format.

This theme support the “@dueTomorrow”, “@dueToday” and “@pastDue” tags styling with yellow,green and red colours as shown in the picture above.

##Style Scope

item[data-dueTomorrow] { ... }
item[data-dueToday] { ... }
item[data-pastDue] { ... }


function TaskPaperContextScript(editor, options) {
    var today = DateTime.format('today');
    var outline = editor.outline;
    outline.groupUndoAndChanges(function () {

      .forEach(function (each) {
      .forEach(function (each) {
      .forEach(function (each) {
      outline.evaluateItemPath('//@due = [d] today')
      .forEach(function (each) {
        each.setAttribute('data-dueToday', '');
      outline.evaluateItemPath('//@due = [d] tomorrow')
      .forEach(function (each) {
        each.setAttribute('data-dueTomorrow', '');
      outline.evaluateItemPath('//@due < [d] today')
      .forEach(function (each) {
        each.setAttribute('data-pastDue', '');


    script: TaskPaperContextScript.toString()

TaskPaper Extensions Wiki