Tinderbox v11 Icon

Action Code

Action code is Tinderbox's method for automation of internal tasks.

Originally, Tinderbox had 'actions' that notes applied to themselves or their children. These were written in 'Action Code' though at the time what is now 'Export Code' was generally used for internal macros (actions). In v4 and v5 this mix was clarified: Export Code moved to being for export only whilst all internal 'coding' was done using 'Action Code', i.e. the style of code used for writing actions.

Action code is now the most likely, indeed only, form of automation users are likely to meet unless they use export features to pass information out of Tinderbox.

Action Code is not a formal coding language (programmers, take note!), and being artisanal software has grown as needed: it has what it needs or its users has asked for. It may lack some features that those with a programming background might assume are 'standard'.

An action is an automatic way of setting a certain attribute to a certain value (with the exception of system read-only attributes which cannot be altered).

Meanings of Action vs. Action code

The differing occurrence of the word 'action' can be confusing.

What is an action? As originally achieved it was essentially the functionality of agent actions, rules and the OnAdd. These allowed notes to alter attribute values in themselves or their children. These were written in action code, which differed from the primary macro, i.e. internal scripting, code of the app—what is now termed export code. Note that macro also has a discrete meaning in both export code ( via ^do^) and action code (via do()).

The older form of 'action' is reflected isn a number of (Action-type) system attribute

Since action code's role expanded, an action generally refers to any complete internal macro. Generally, they way the form:

[left side] assignment [right side]

For example, at simplest:

$Color = "blue" 

Or, with a degree of evaluation or either side:

$MyString("Some note") = $Color.hue 

Multiple discrete (complete actions) are delimited/terminated by a semi-colon):

$Color = "blue";$AccentColor = "red"; 

or as a semi-colon is optional after the last/only action:

$Color = "blue";$AccentColor = "red";$Badge="ok" 

Note too, that whitespace around the assignment is ignored when the app parses )'reads') action code.

All the code above is action code.

Action code syntax

For long time users of Tinderbox, action code replaces all older #-prefix query code and many ^export^ codes. Indeed, use of ^export^ code inline in actions is now discouraged (any support is only for legacy code).

(Agent) queries are also written in Action Code

Thus a query, in action code, might be:

$Name == "Foo" (is this note's title the exact string 'Foo'?)

Or, with multiple terms:

$Name == "Foo" | $Name == "Bar" (is this note's title the exact string 'Foo' OR 'Bar'?)

As well as in agents queries, are use in a number of places such as smart adornments, find() and in action operators with conditional arguments. Be aware that many operators that have a scope of action (i.e. objects read from and/or acted upon) may also define thet scope via a query.

Case sensitivity

All action code operators are always case-sensitive (unlike export codes).

Making/deleting notes: See create(), createAgent() and delete().

Action code Syntax

This is expanded upon under basic action code syntax. Note the point above re case-sensitivity.

Further discussion of use of actions:


See also—notes linking to here: