Script to append something to the current search

More curiosity than deep-seated need, but I was wondering if there’s a way to use a script to append something to the current search, rather than replacing it outright.

I’ll tag things that are on my to-do list with @waiting if something needs to happen before I can complete it. Sometimes I want to filter out the tasks I’m waiting on something else for so I can focus on what I’m able to work on right now. Rather than having an additional 3 or 4 shortcuts for not @waiting versions of my standard searches, it’d be cool if I had just one shortcut that could append “and not @waiting” to whatever my current search is.

Is that something a script is capable of doing?

Thanks!

Yes, you could do this:

function AndNotWaitingTaskPaperContextScript(editor, options) {
  editor.itemPathFilter += " and not @waiting"
}

Application("TaskPaper").documents[0].evaluate({
  script: AndNotWaitingTaskPaperContextScript.toString()
})
1 Like

Huzzah! Thank you so much.