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

preset

Store and recall the settings of other objects

Description

preset can store and recall the parameters of any specified user interface objects at the click of a mouse.

Arguments

None.

Messages

bang Sends out the settings of the preset that was most recently recalled with an int or a mouse click.
int preset-number [int]
The number indicates a preset, and the settings stored in that preset are sent out to the connected objects, or to all objects in the window if no patch cords are connected to the preset object's outlet. The settings in a preset can also be sent out by clicking on the preset with the mouse.
float preset-number [float]
Converted to int.
list Same as bang.
clear preset-number [int]
Erases the contents of the most recently sent preset. The word clear, followed by a number, erases the contents of that numbered preset.
clearall Erases the contents of all presets.
(mouse) Clicking on a button in the preset object will recall a stored preset.

Shift-clicking on a button in the preset object will store a preset.
name ID-filetag [symbol]
The word name, followed by a symbol, sets the ID Name for the preset. The ID Name allows the preset to have a unique ID so that files created for it will not read into other presets.
store preset-number [int]
The word store, followed by a number, stores the current setting of all user interface objects in the same window in the preset indicated by the number. If objects are connected to the preset object's left outlet with patch cords, only those connected objects will be affected.

The presets (storage locations in the preset object) are numbered left-to-right, top-to-bottom. When settings are stored in a preset, the dot's color changes to indicate that it contains something. Settings can also be stored in a preset by holding down the Shift key and clicking on the preset with the mouse.
read preset-number [int]
The word read, followed by no arguments or a number, displays an Open Document dialog box for choosing a file of preset data to read. If the preset has been given a Preset Name Code, only files of the type specified by the code will be displayed. The number argument specifies the preset number into which the file data should be read. If the number is 0 or -1, the data in the file will be read into the number of presets contained in the file starting with the first one. If the word read is followed by a symbol or a number and a symbol, no dialog box is displayed. Instead, the symbol is taken as a filename from which to read presets. The number functions as already described.
write preset-number [int]
The word write, followed by no arguments or a number, displays a Save As dialog box for specifying a destination filename for writing the preset data. If the preset has been given a Preset Name Code, the file is given this code as its file type. The number argument specifies the preset number from which the preset data should be written. If the number is 0 or -1, all presets will be written. If the word write is followed by a symbol or a number and a symbol, no dialog box is displayed. Instead, the symbol is taken as a filename to use for writing the data; the file will be placed in the current default folder. The number functions as already described.

Attributes

Name Type g/s Description
active1 float Sets the first (upper) gradient color for active presets in RGBA format.
active2 float Sets the second (lower) gradient color for active presets in RGBA format.
bgcolor float Sets the background color in RGBA format.
bordercolor float Sets the border color in RGBA format.
bubblesize int
def.:9
Sets the size of the preset "bubble", in pixels. A bubble must be larger than 2 pixels.
circlecolor float Sets the color used for the circle displayed when the mouse is over a preset button in RGBA format.
clicked1 float Sets the first (upper) gradient color for clicked presets in RGBA format.
clicked2 float Sets the second (lower) gradient color for clicked presets in RGBA format.
embed int
def.:1
Toggles the ability to save your presets as part of the main patch (just as with a The default behavior is 0 (don't save).
emptycolor float Sets the color for empty preset locations in RGBA format.
margin int
def.:3
Sets the edge spacing in pixels, for the preset object's panel
pattrstorage symbol the pattrstorage attribute takes as its argument the name of a pattrstorage object and sets the preset object to allow its use as a user interface object for the named pattrstorage object's contents.
showtrack int
def.:1
Toggles the display of preset numbers on mouse-over. The default setting is 1 (on).
spacing int
def.:3
Sets the spacing, in pixels, between bubbles
stored1 float Sets the first (upper) gradient color for stored presets in RGBA format.
stored2 float Sets the second (lower) gradient color for stored presets in RGBA format.
textcolor float Sets the color of the text (number) displayed on mouseover in RGBA format.

Information for box attributes common to all objects

Output

(internal): Any user interface objects connected to the third outlet of preset will be excluded from the effects of that preset. (This is particularly useful when there are many objects you want to affect with preset, and only a few you want to exclude.)

Objects whose data is stored in a preset include: dial, Ggate, Gswitch, led, number box (both int and float), slider, and toggle. The contents of a table can also be stored and recalled by preset, but the table must be connected to the preset object's outlet with a patch cord. The outlet of preset can also be connected to a send object, to communicate with objects connected to a receive object of the same name.

The number of visible presets can be adjusted by resizing the preset object's box. The maximum number of presets in a single preset object is 2048.
int: Out second outlet: When a preset is recalled, the number of the preset is sent out.
int: Out fourth outlet: When a preset is stored, the number of the preset is sent out.
int or float: Out left outlet: When a preset is recalled, either by a mouse click or by a number in the inlet, the settings stored in that preset are sent out the outlet to all connected objects, or, if no objects are connected, to all user interface objects in the window.

Examples

Remember many past settings and recall them later

See Also

Name Description
grab Intercept the output of another object
Max pattr Tutorial 1: Patcher Storage Max pattr Tutorial 1: Patcher Storage