I guess the first two things that come to mind are:
- If your set of projects is stable, full search paths which include the project name as well as
@doneor(not @done) - or a script along the lines below, which offers a menu of the @searches in the document, and applies them with the name of any focused item (e.g. focused project) prepended
http://guide.taskpaper.com/using_scripts.html
// Ver 0.03
(function () {
'use strict';
// TASKPAPER CONTEXT
function contextualSearches(editor) {
var itemFocused = editor.focusedItem;
return editor.outline.evaluateItemPath('//@search')
.reduce(function (a, item) {
var strSearch = item.getAttribute('data-search');
return (
strSearch && (
a[item.bodyContentString] = strSearch
),
a
);
}, {})
}
function applyFilter(editor, options) {
var strFilter = options.filter || '';
editor.itemPathFilter = strFilter;
}
// JAVASCRIPT FOR AUTOMATION CONTEXT
var tp3 = Application('com.hogbaysoftware.TaskPaper3'),
ds = tp3.documents,
d = ds.length ? ds[0] : (
ds.push(tp3.Document()), ds[0]
);
var dctSearches = d.evaluate({
script: contextualSearches.toString()
}),
lstSearches = Object.keys(dctSearches),
lngSearches = lstSearches.length;
if (lngSearches) {
var a = Application('System Events'),
sa = (a.includeStandardAdditions = true, a),
varChoice = lngSearches > 1 ? (
sa.activate(),
sa.chooseFromList(lstSearches, {
withTitle: dctSearches.focusItem || 'Whole document',
withPrompt: 'Filter:',
defaultItems: lstSearches[0],
okButtonName: 'OK',
cancelButtonName: 'Cancel',
multipleSelectionsAllowed: false,
emptySelectionAllowed: true
})
) : lstSearches;
if (varChoice && varChoice.length) {
d.evaluate({
script: applyFilter.toString(),
withOptions: {
filter: dctSearches[varChoice[0]]
}
})
}
}
})();