I often write several paragraphs of notes in the projects. It looks strange if the notes are much larger block than project & task. I think it’ll help if I could collapse and expand the notes only and keep the project & task unchanged.
Instead of a specialized folding command could you do this with a not @type = note
search?
It could but not good, I think. Taskpaper intriguing me lies that I could write notes conveniently in it and display them naturally. It hampers its advantages if the toggle so inconvenient.
Or it could be done by a script, I guess.
You could try something like this:
http://guide.taskpaper.com/using_scripts.html
(function () {
'use strict';
// TASKPAPER CONTEXT
function toggleNoteExpansion(editor, options) {
'use strict';
var lstNoteParents = editor.outline.evaluateItemPath(
'//@type=note/parent::*'
),
// Toggle all on state of first note parent found in document
oParent = lstNoteParents.length ? lstNoteParents[0] : undefined,
strState = oParent && editor.isExpanded(oParent) ? (
'Collapsed'
) : 'Expanded';
return (
oParent && editor['set' + strState](lstNoteParents),
oParent ? strState : "No notes found"
);
}
// JAVASCRIPT FOR AUTOMATION CONTEXT
var tp3 = Application('com.hogbaysoftware.TaskPaper3'),
ds = tp3.documents,
d = ds.length ? ds[0] : undefined;
return d && d.evaluate({
script: toggleNoteExpansion.toString()
});
})();
It works so great, thanks!
Hi complexpoint…
I come through this script of yours but it gives me an error…
is it too old?
Thanks anyway for your other “notes script”
The line which uses the application id string 'com.hogbaysoftware.Taskpaper3'
needs an updated reference.
Enough, I think to just edit the value of “tp3” to:
Application("Taskpaper")
instead.
So, blowing off some of the dust, something like, for example:
Expand disclosure triangle to view JS Source
(() => {
"use strict";
// ---------------- TASKPAPER CONTEXT ----------------
const toggleNoteExpansion = editor => {
const
parents = editor.outline.evaluateItemPath(
"//@type=note/parent::*"
),
// Toggle all on state of first note parent
// found in document
firstParent = parents.length ? (
parents[0]
) : undefined,
state = firstParent && editor.isExpanded(
firstParent
) ? (
"Collapsed"
) : "Expanded";
return (
firstParent && editor[`set${state}`](parents),
firstParent ? (
state
) : "No notes found"
);
};
// -------- JAVASCRIPT FOR AUTOMATION CONTEXT --------
const
tp3 = Application("TaskPaper"),
ds = tp3.documents;
return 0 < ds.length ? (
ds.at(0).evaluate({
script: `${toggleNoteExpansion}`
})
) : "No documents open in TaskPaper 3";
})();
thanks, now superseded by yours new Feb 5