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

text

Format messages as a text file

Description

Collects and formats incoming messages as text to be output as lines of text.

Examples

Collect messages as text, to paste elsewhere or to save as a separate file

Arguments

filename [symbol]

Names a text file to be read in when the object is loaded.

Attributes

precision [int]

Float Precision

Common Box Attributes

annotation [symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

background [int] (default: 0)

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 removes it. Objects in the background layer are shown behind all objects in the default foreground layer.

color [4 floats]

Sets the color for the object box outline.

fontface [int]

Sets the type style used by the object. The options are:

plain
bold
italic
bold italic

Possible values:

0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'

fontname [symbol]

Sets the object's font.

fontsize [float]

Sets the object's font size (in points).

Possible values:

'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'

hidden [int] (default: 0)

Toggles whether an object is hidden when the patcher is locked.

hint [symbol]

Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.

ignoreclick [int] (default: 0)

Toggles whether an object ignores mouse clicks in a locked patcher.

patching_rect [4 floats] (default: 0. 0. 100. 0.)

Sets the position and size of the object in the patcher window.

position [2 floats]

g/s(set)

Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.

presentation [int] (default: 0)

Sets whether an object belongs to the patcher's presentation.

presentation_rect [4 floats] (default: 0. 0. 0. 0.)

Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.

rect [4 floats]

g/s(set)

Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).

size [2 floats]

g/s(set)

Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.

textcolor [float]

Sets the color for the object's text in RGBA format.

textjustification [int]

Text Justification

Possible values:

0 = 'left'
1 = 'center'
2 = 'right'

varname [symbol]

Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.

Messages

int

Arguments

input [int]
Stores the integer within text.

float

Arguments

input [float]
Stores the float within text.

list

Arguments

input [list]
Stores the list within text.

anything

Arguments

input [list]
The message is stored in the text object, placed after any previously stored messages, and is followed by a space.

clear

Erases the contents of text.

cr

Puts a carriage return at the end of the contents of text, to start a new line. If the last character in text is a space, the carriage return replaces that space.

(mouse)

Double-clicking with the mouse on the text object (when the patcher window is locked) opens an editing window in which the contents of text can be viewed and edited. The text object ignores messages to change its text while the editing window is open. Unlike the capture object, changes made in the editing window of text actually alter the contents of the object.

dump

The word dump causes text to send its contents out of the object's left outlet.

editwith

Arguments

editor [symbol]
The word editwith, followed by a symbol that specifies a text editor, will open the file for editing using the specified editor.

filetype

Arguments

filetype-code (four letters) [symbol]
The word filetype, followed by a symbol, sets the file types which can be read and written into the text object. File types are specified using the standard four-letter filetype code (e.g. filetype ffoo). The message filetype with no arguments restores the default file behavior -- either Max binary or text file formats. File types are mapped to filename extensions on Windows based on the messages to max contained in the file max-fileformats.txt in the init folder, which is loaded on startup. If you are defining your own filetype, you may want to include your own text file in the init folder in order to specify a mapping between an extension and your four-letter type code.

line

Arguments

index [int]
The word line, followed by a number, causes text to send out the contents of that line number (up to 256 characters) with the word set prepended (for setting the contents of a message box). Lines are numbered beginning with 1; any line number message less than 1 is converted to line 1. If a nonexistent line number is requested, nothing is sent out.

open

Opens the object's text window for editing. Double-clicking on the text object in a locked patcher has the same effect. The text object ignores messages to change its text while the editing window is open. Unlike the capture object, changes made in the editing window of text actually alter the contents of the object.

read

Arguments

filename [symbol]
The word read, followed by a symbol that specifies a filename, will read the contents of a text file. If no filename or pathname is specified, the read message will call up the standard Open Document dialog box, so that a text file can be specified. Use the filetype message to use a custom filetype with this object.

query

The word query sends a number that specifies the number of lines stored in the text object out the object's right outlet.

t_symbol

Arguments

input [symbol]
Stores the symbol within text.

tab

Puts a tab stop at the end of the contents of text. If the last character in text is a space, the tab stop replaces that space.

settitle

Arguments

window-name [symbol]
The word settitle, followed by any word, sets the title of the text window. If you want more than one word to appear as the default text, you must enclose the words in double quotes or precede the spaces with a backslash (\).

symbol

Arguments

any symbol [symbol]
The word symbol, followed by any word, stores that word at the end of the contents of text. This is useful if you want to store a word that would otherwise be understood as a specific message by text. For example, symbol clear stores the word clear, followed by a space, at the end of the contents of text, rather than erasing the contents.

wclose

Closes the window associated with the text object.

write

Arguments

filename [symbol]
The word write, followed by a symbol that specifies a filename, will save the contents of text as a text file in the current default folder unless the file is specified with an absolute pathname. If no filename or pathname is specified, the write message will open up a standard Save As dialog box, so that the contents of text can be saved in a separate text file. Use the filetype message to use a custom filetype with this object.

Output

bang

Out middle outlet: When a file has finished loading in response to a read message, a bang is sent out the middle outlet.

int

Out right outlet: In response to a query message, a number corresponding to the number of lines of text stored in the text object is sent out the right outlet.

symbol

Out left outlet: When a line message is received, the text of the specified line number is sent out preceded by the word set. The message can be used to set the contents of a message box (or can be sent to any other object for which that particular set message is appropriate).

See Also

Name Description
Working with OpenGL Working with OpenGL
Max For Live Max For Live
capture Store values to view or edit
filein Read and access a file of binary data
itable Data table editor
spell Convert input to UTF-8 (Unicode) codes
sprintf Format a message of words and numbers
table Store and edit an array of numbers
textedit Enter text