How to quickly append current date to each task?


#1

Is there some quick way to append the current date next to each task I create - either automagically, or upon typing some static tag (i.e not requiring typing the date by hand)? I could not find this in the docs.

Why do I want this? To provide a reference for when a task was created, which tells me how long it is been sitting in my queue.

Thanks.


#2

I use TextExpander for this. Alfred (which I use constantly) also lets you create text snippets for dates, but TextExpander also lets you create snippets that do date math i.e. type d.w1 to automatically insert the date one week in the future. As far as I know there’s no native (i.e. TaskPaper only) solution but using TextExpander (or another snippet manager) with TaskPaper really lets you take advantage of the format.


#3

If you want tag-format timestamping of the current/selected item(s), without having to position the cursor for insertion, you can use a TaskPaper script

https://guide.taskpaper.com/using_scripts.html

perhaps using it from the command palette, or attaching it to a keystroke with something like Keyboard Maestro:

In a draft script like the one below you can edit the last line to adjust the name of the tag used for date-time stamping:

(function (strTag) {
    'use strict';

    // TASKPAPER CONTEXT

    function TaskPaperContext(editor, options) {
        var outline = editor.outline,
            strTime = DateTime.format(Date()),
            strTagKey = 'data-' + (options.timestampTag || 'created');

        outline.groupUndoAndChanges(function () {
            editor.selection.selectedItems
                .forEach(function (item) {
                    item.setAttribute(strTagKey, strTime);
                });
        });

        return strTime;
    }

    // JAVASCRIPT FOR AUTOMATION CONTEXT

    var tp3 = Application('TaskPaper'),
        ds = tp3.documents;

    return ds.length ? ds[0].evaluate({
        script: TaskPaperContext.toString(),
        withOptions: {
            timestampTag: strTag
        }
    }) : undefined;

})('created');