News:IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).

If I want to create an agent that finds all the notes inside Items that contain, say, "todo", I simply create an agent note that has

$AgentQuery = "(inside(items)) & $Name.contains("todo");"

Fair enough.

Now here is what I want to do:

* create a new agent and name it "pending"* set the prototype of this agent to, say, "protoNameTextAgent"

What I would like to do is have this agent named "pending" automatically find all the notes inside "items" that contain the word "pending" (i.e., the same text as the $Name of the agent itself). This way I can quickly create agents that find notes that have a given word in them.

- - -

I've confirmed that such an agent works when

$AgentQuery = "(inside(items)) & $Name.contains($Name(agent));"

However, I haven't figured out how to make this happen through the mechanism of assigning a prototype to a new agent. I'm open to other ways to create the same result without having to do everything manually.

You don't need the extra parentheses around the inside() operator. Also, 'Items' is a note name and so should be enclosed in quotes (by convention, only designator strings like 'parent' or 'agent' aren't quoted, but still work if quoted). Note names are case sensitive so an inside() call for "items" will not match notes in "Items".

To set that via an action, place the whole action in quotes. As double quotes are already used, use the single quotes for this:

$AgentAction = 'inside("Items") & $Name.contains("todo")';

But, you don't need to do the latter. Make a prototype note [sic] with the name 'protoNameTextAgent'. Use Get Info or Quickstamp to set the note's $AgentQuery. Althuogh note's don't make use of attributes in the 'Agent' group, they may still have values assigned - for scenarios just like this one here. IF using Get Info, don't use the 'agent' sub tab as only actual agents have that active, you must use the 'attributes' sub-tab and then select the 'Agent' group. The value to paste into $AgentQuery is:

inside("Items") & $Name.contains($Name(agent))

No outer quotes needed as were setting the value directly into the attribute rather than by an action.

Now, to use the prototype, make a new agent and immediately close the pop-over that opens. Rename the agent to the desired search term and set the agent to use the protoNameTextAgent prototype.

If you want you can make a container with the $OnAdd:

$Prototype = "protoNameTextAgent";

This will automate the last step above for you for any new agents you make in that container.