Something like this ?
Expand disclosure triangle to view JS source
(() => {
"use strict";
// Selection moved to:
// First incomplete non-empty row after current selection
// Rob Trew @2026
// Ver 0.03
const
neitherDoneNorBlank = '(not @done and @text != "")',
followingNotDone = `following::${neitherDoneNorBlank}`;
// ------------------- JXA CONTEXT -------------------
// main :: IO ()
const main = () => {
const doc = Application("TaskPaper").documents.at(0);
return doc.exists()
? doc.evaluate({
script: `${TaskPaperContext}`,
withOptions: { followingNotDone }
})
: "No documents open in TaskPaper";
};
// ---------------- TASKPAPER CONTEXT ----------------
// TaskPaperContext :: Editor -> IO ()
const TaskPaperContext = (editor, { followingNotDone }) => {
const
matches = editor.outline.evaluateItemPath(
`${followingNotDone}[0]`,
editor.selection.startItem
),
match = matches && (0 < matches.length)
? matches[0]
: null;
return match
? (
editor.moveSelectionToItems(
match, match.bodyString.length
),
match.bodyContentString
)
: "No remaining incomplete tasks in document.";
};
// MAIN ---
return main();
})();
preceding → following
[-1] → [0]