A newer version of Max is available. Click here to access the latest version of this document.

autopattr

Expose multiple objects in a patcher to the pattr system

Description

The presence of an autopattr object in a patch will cause multiple objects within a patcher to be automatically included in the pattr system according to certain inclusion settings.

Arguments

Name Type Opt Description
object-name symbol opt A symbol argument can be used to set the autopattr object's name. In the absence of an argument, the autopattr object is given an arbitrary, semi-random name, such as u197000004.

Messages

bang A bang is passed through the autopattr object and output from its center right outlet.
int input [int]
An int is passed through the autopattr object and output from its center right outlet.
float input [float]
A float is passed through the autopattr object and output from its center right outlet.
list input [list]
A list is passed through the autopattr object and output from its center right outlet.
anything input/arguments [list]
Any message is analyzed. If the first element of the message matches the name of an object maintained by the autopattr, the subsequent arguments in the message set that object's value. If the first element of the message matches get (name), where (name) matches the name of an object maintained by the autopattr, the value of that object is sent from the autopattr object's right outlet, prepended by the object's name. Otherwise, the message is passed through the autopattr object and output from its center right outlet.
getattributes Causes a list of all objects names maintained by the autopattr object to be output from the right outlet, prepended by the symbol attributes.
getstate Causes a series of lists to be output from the autopattr object's right outlet, one for every object maintained by the autopattr. Each list begins with the name of the object, and is followed by the object's current value.

Attributes

Name Type g/s Description
autoname int The word autoname, followed by a 1 or 0, enables or disables the autopattr object's autoname state. The default is 0 (off). When enabled, the autopattr object will automatically name any unnamed objects in the patcher supported by the pattr system and bind to them, if possible. Naming only occurs when the patcher loads, when the autopattr object is reinstantiated, or when the autopattr object receives the message autoname 1. New objects placed in a patcher after the autopattr has been instantiated will not be autonamed until one of these conditions is met.
autorestore int The word autorestore, followed by a 1 or 0, enables or disables the autopattr object's autorestore state. The default is 1 (on). When enabled, the autopattr object will automatically output its last-saved values when the patcher is loaded, and distribute them to bound objects. Values are saved whenever the patcher is saved.
dirty int The word dirty, followed by a 1 or 0, enables or disables the patcher-dirty flag. The default is 0 (disabled). When enabled, the autopattr object will dirty the patch whenever its state changes.
greedy int The word greedy, followed by a 1 or 0, enables or disables the attribute-gathering feature of the autopattr object. The default is 0 (disabled). When enabled, any internal attributes of objects attached to the left outlet of the autopattr object will be exposed to the pattr system (as well as the normal value, if present).
name symbol The word name, followed by a symbol, sets the autopattr object's patcher name.

Information for box attributes common to all objects

Output

(internal): Out left outlet: Any user interface object (or other object that responds to the internal messaging system utilized by autopattr) connected to the left outlet of the autopattr object will be automatically named (if necessary) and bound to. If the autopattr object's greedy attribute has been enabled, any attributes associated with the bound object will also be exposed to the pattr system. The name is automatically generated from the object's class name (e.g. a connected number box might be named number[1].) At the time of this writing, the following Max user interface objects can be bound in this fashion: dial, function, gain~, ggate, gswitch, js, jsui (see the JavaScript in Max manual for more information on using the pattr system with JavaScript), led, matrixctrl, multislider, number box (int and float), pictctrl, pictslider, radiogroup, rslider, slider, table, textedit, toggle and umenu.

Out center-left outlet: Any user interface object (or other object that responds to the internal messaging system utilized by autopattr) connected to the center left outlet of the autopattr object will be automatically named (if necessary) and excluded from the autopattr object's bound-object list.
anything: Out center-right outlet: Any message not matching a get or set request to an object maintained by the autopattr is passed, unchanged, through the center right outlet.

Out right outlet: get queries to an object maintained by the autopattr are output from the right outlet, also known as the dumpout outlet.

Examples

See Also

Name Description
pattr Patcher-specific, named data wrapper
pattrforward Send any message to a named object in the patcher hierarchy
pattrhub Access all of the pattr objects in a patcher
pattrmarker Create pattr 'share points' and communicate between patcher hierarchies
pattrstorage Save and recall presets of pattr data
Max pattr Tutorial 2: Automatic Bindings and Storage Max pattr Tutorial 2: Automatic Bindings and Storage