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

savedialog

Open a dialog to ask for a filename for saving

Description

savedialog takes a list of one or more file types and allows you to save a file and choose a type for it. To choose a folder, use the "fold" type. savedialog reports the entire pathname of the file or folder chosen, which can be passed to any Max object after the word write or save.

Arguments

Name Type Opt Description
filetype(s) symbol opt Sets one or more file types that will be displayed as choices for the user. The symbol fold specifies that the dialog box should let the user choose only folders.

Messages

bang Causes a standard Save As dialog box to appear, allowing the user to type in a filename and choose a folder location. The resulting location and filename are output as a symbol.
anything filetype [list]
One or more four-letter type codes sets the list of types displayed in the dialog box. Example type codes for files are TEXT for text files, maxb for Max binary format patcher files, and AIFF for AIFF format audio files. The symbol fold specifies that the dialog box should let the user choose only folders.
name filename [symbol]
The word name, followed by a symbol, specifies a default file name.
set filetype [list]
The word set, followed by a four-letter symbol (e.g., TEXT, MAXB) which specifies a file type, sets the savedialog object to display the desired file type without opening the dialog box. The chosen file type is sent out the middle outlet when the user chooses Save in the dialog box.

Information for box attributes common to all objects

Output

bang: Out right outlet: If the user chooses Cancel in the dialog box, a bang is sent out.
symbol: Out left outlet: The absolute pathname of the file as a symbol. The output pathnames contain slash separators.

Absolute pathnames look like this:

"C:/Max Folder/extras/mystuff/mypatch.pat"

The conformpath object can be used to convert paths of one pathtype and/or pathstyle to another.
symbol: Out middle outlet: The four-letter symbol which specifies the filetype currently selected.

Examples

Select a folder or a specific file type for file saving

See Also

Name Description
conformpath Convert paths of one pathtype and/or pathstyle to another
dialog Open a dialog box for text entry
filedate Report the modification date of a file
filein Read in a file of binary data
filepath Report information about the current Max search path
opendialog Open a dialog to ask for a file or folder