text Reference

Format messages as a text file

text

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]

The number of decimal places for converted floating point values.

Common Box Attributes

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.

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.

query

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

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.

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.

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.

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
filein
itable
spell
sprintf
table
textedit
External Text Editor External Text Editor