Further to @pat’s answer, the OnAdd is an action applied to an item placed into, or created within a container. The latter can be a note or as a special case in maps, an adornment. In the latter case, dragging an item onto an adornment fires it’s OnAdd. In fact, agents do the same thing to aliases they create for notes matching their query, but the action is termed the ‘agent action’.
Whereas an OnAdd is stored in the attribute $OnAdd, an agent’s action is stored in $AgentAction. However, depending on where the selected item is an agent or a note, the ‘action’; sub-tab of the Action Inspector shows the $OnAdd or $AgentAction code in the same place. That may seem odd until you realise no item has both forms of action.
I think @dberreby is ask how to carry out an action. IOW, “I have a note selected and wish to apply an action to it.”. If so there are 2 main methods:
*Quickstamp. This is useful for short/quick actions. The action code used (as opposed to the effect of its use) is lost as soon as note focus changes.
*Stamp. Does the same thing but you define and save the action code for the stamp before use and it is available for later re-use.
So, QuickStamp/Stamp are applied manually once per press of the ‘Apply’ button.
OnAdd actions apply at least once on an item appearing (created or moved) in a container.
Agent actions apply every time the agent cycle runs.
A rule is an action applied to itself by a note every time the rule cycle runs.
An edict is essentially a lazy form of rule. Stored separately from the rule, the edict’s action is run infrequently on the note: i.e. for tasks that aren’t urgent but shouldn’t be forgotten.
I’m still not 100% sure of which of these action contexts is desired but hopefully that gives an indication of how they differ. All are written as action code.
Lastly, although (for legacy support reasons) Tinderbox will work with (some) unquoted strings of text, to set a note’s prototype to ‘X’ use code like this:
The closing semi-colon is only mandatory if the action includes more than one discrete expresiion within it. Thus:
Here the ‘2’ is a number (not string) so is not quoted and as thelast expression no semi-colon is needed. But, the semi-colon after “X” is needed so that Tinderbox understands there are two discrete expressions within the action.