I’m sorry - I just came across TaskPaper and this looks so good! But: I’m missing one thing - I’d like to see the timestamp when I finished a task - like @done 2016-03-21 10:11. Can I achieve that somehow? Haven’t found no solution on the forums or the options page.
Thanks
Ben
I don’t know enough about Javascript to get the date/time formatted nicely, but the script below will yield a tag formatted like @done(2016-03-28 15:33:54:457) (down to the millisecond!) It will also toggle the status (so removing the “done” tag if it already exists)
function TaskPaperContextScript(editor, options) {
function setAttribute(editor, items, name, value) {
var outline = editor.outline;
var selection = editor.selection;
outline.groupUndoAndChanges(function() {
items.forEach(function (each) {
each.setAttribute(name, value);
});
});
editor.moveSelectionToItems(selection);
}
function toggleAttribute(editor, items, name, value) {
items.forEach(function (each) {
if (each.hasAttribute(name)) {
value = null; // If any item has the attribute, then remove it from all.
}
});
setAttribute(editor, items, name, value);
}
toggleAttribute(editor, editor.selection.selectedItems, 'data-done', DateTime.format('now'));
}
Application("TaskPaper").documents[0].evaluate({
script: TaskPaperContextScript.toString()
});
Awesome, thanks! The full script for those who just want to copy/paste:
function TaskPaperContextScript(editor, options) {
function setAttribute(editor, items, name, value) {
var outline = editor.outline;
var selection = editor.selection;
outline.groupUndoAndChanges(function() {
items.forEach(function (each) {
each.setAttribute(name, value);
});
});
editor.moveSelectionToItems(selection);
}
function toggleAttribute(editor, items, name, value) {
items.forEach(function (each) {
if (each.hasAttribute(name)) {
value = null; // If any item has the attribute, then remove it from all.
}
});
setAttribute(editor, items, name, value);
}
toggleAttribute(editor, editor.selection.selectedItems, 'data-done', DateTime.format('this minute'));
}
Application("TaskPaper").documents[0].evaluate({
script: TaskPaperContextScript.toString()
});
(I can’t remember if @jessegrosjean or @complexpoint wrote the original script for this, but credit for it goes entirely to them!)
I already told I’m new, so I hope you don’t mind my next question (isnt explained in the FAQ or the manual): what Do I do with this code above? Don’t see any inapp code/script editor or so.
I used Keyboard Maestro, which (among many other things) lets you link the script to a hotkey (like the default ⌘D for done tasks).
There should also be a way to save it as a Service, which you could then assign a hotkey in System Preferences. I’m not sure how to do it myself, but I believe I’ve seen someone explain it in one of the other script posts in this form. (List of the script posts is here)
@esotaria, I stopped keeping that page up to date and I have been working on and organizing the official “extensions” page. It should be in pinned at the top of the forums. Here is a link
No you shouldn’t need a script, it should just be controlled by the “Include date when tagging task with @done” setting in preferences. A few possibilities:
If you type out the done tag … i.e. manually type @done (or partially type it and use autocomplete to finish) a date is not added. Dates are only added when you do menu Tag > Done (or it’s Command-D) shortcut. Or when you add tags using the menu Tag > Tag With… (Command-T)
I’ve just been testing and this all seems to be working on TaskPaper 3.7.3.
If that still doesn’t help try:
Quit TaskPaper
Delete TaskPaper’s preferences plist.
Restart TaskPaper.
Please let me know if any of the above solve or not.
I know this is an old thread, but some of the links from it are broken, so I was having a bit of trouble. I did get it to work with KeyboardMaestro, but that has to be with a keyboard shortcut. Normally I am all about keyboard over mouse, but I am somehow used to just clicking the dash at the beginning of each task to mark it as done. Is there any way to use this script to add the timestamp when I do that? Perhaps this is not possible, but seemed worth asking since the FAQ @jessegrosjean posted has gone stale (not even in the Internet Archive!).
Sorry I don’t think you can do it without the keyboard shortcut method.
And the FAQ that I posted above was for the wrong app anyway (it was a link to FoldingText’s guide, which I sold to another developer). Anyway the current link for installing scripts would be:
Is there any way to disable clicking the dash to mark as done? I’m having a hard time switching my habit to using cmd-D and I think it would help if clicking no longer did anything.