Finding all notes with prototype pTask

I am still struggling with the basics. I have a prototype called pTasks. I want to create an agent that simply lists all tasks – at this point, not trying to distinguish completed tasks or anything, just want to get this first step done. My Tinderbox file is quite small, still experimental, and has only 2 or three notes with the pTask prototype.

I tried creating an agent called Find Tasks with this AgentQuery: $Prototype.beginsWith(“pTask”).

Nothing happens. What am I doing wrong?

I think you want your query to be: $Prototype=“pTask”

Almost, but in a query an equality test, as in “is A the exactly the same as B?” we should use ==. So the query is:

$ Prototype=="pTask"

†. No foul here. Because of legacy support for very old action code (some could be >20 years old!) where only = was used, the single form will work. But so as to get started on best practice, go with ==

It’s true that $Prototype=="pTask" is probably what you want, since you wanted to list all tasks. You query would also work, but it would also find any note with a prototype named pTaskforce. That might not be what you want.

Still, your query should work! And it does work: I just tested it. What might have gone wrong is that you want to use straight quotes ( " ) and not curly quotes ( “ ” ); the forum software has a tendency to turn people’s straight quotes into curly quotes, but that’s worth checking.

If that doesn’t solve the puzzle, why not upload your test file here? I’m sure we’ll straighten it out quickly.

Here’s my file.
new tinderbox.tbx (227.3 KB)

I think your query is failing for tasks a your agent for tasks was actually a note. Here I’ve renamed your ‘agent’ to “Find Tasks - note” and added an agent using the same query:

See Content and Type Dependent Icons for more on the outline view note icons.

Your file, with that change: new tinderbox1.tbx (546.4 KB)

Excellent, good to know. Thanks for the quick response.

1 Like

It was late when I posted, so I’d add a little extra clarification as to how this error occurred. It’s easy in the moment to hit Return, with a new agent in mind, but actually make a note. Historically we’d a have used the inspector to add the agent query, which Tinderbox detects for use:

We can’t enter a query here as the ‘agent’ is actually a note. In fact if you select your agent-note in your demo and view the Query Inspector, i.e. as above, the code is there but the rest of the pane is grey. A good prompt, now we know, that we may have made an error.

For clarity, there is no mechanism to alter an existing note into an agent or vice-versa.

Or we might try and set—for a note—a query via Get Info. Tinderbox has this error covered too:

The way the error occurred here (the presumption of a note being an agent, was because the query was set via action code. This routes around Tinderbox’s defences. No harm is done, but the result is the simple error of using a note where an agent was expected is not caught.

If you want to check if you’ve other notes mis-purposed as agents, from v9.3.0 (and the addition of $IsAgent) you can make a agent with this query:

$AgentQuery!=""&!$IsAgent

Here I’ve added it to my previous test doc:

Sure enough, the faux agent “Find Tasks - note” is detected.

Thanks Mark for the additional clarification. I’ll be away from my computer for most of the next week or so. Will play around with this a bit more when I return.

1 Like