opendialog

Open a dialog to ask for a file or folder

Description

The opendialog object takes a list of one or more file types and allows you to select a file from among those types. To choose a folder, use the "fold" type. opendialog reports the entire pathname of the file or folder chosen, which can be passed to any Max object after the word read or load.

Arguments

Name Type Opt Description
folder-flag symbol opt Sets opendialog to choose folders instead of files.
audio-file-flag symbol opt Sets opendialog to list audio files (AIFF, NeXT/Sun, and WAV, along with some generic data file types). The QuickTime appendix lists all the files that can be opened.
file-types symbol opt One or more symbols set the list of file types that determine which files are listed by the opendialog object.

Messages

bang Opens a standard Open Document dialog box for choosing a file.
anything filetype [list]
One or more symbols are interpreted as one or more type codes used to determine which files are listed by the opendialog object. Example type codes for files are TEXT for text files, maxb for Max binary format patcher files, and AIFF for AIFF format audio files. types with no arguments makes the object accept all file types, which is the default setting.
set filetype [list]
The word set, followed by a four-letter symbol (e.g., TEXT, maxb) which specifies a file type, sets the opendialog object to search for the designated file type when opening the dialog box.
types filetype [list]
The word types, followed by one or more four-letter type codes, determines which file types are listed by the opendialog object. Example type codes for files are TEXT for text files, maxb for Max binary format patcher files, and AIFF for AIFF format audio files. types with no arguments makes the object accept all file types, which is the default setting.
sound Sets opendialog to list audio files (AIFF, NeXT/Sun, and WAV, along with some generic data file types).

Information for box attributes common to all objects

Output

bang: If the dialog box is cancelled by the user, a bang message is sent out the right outlet.
symbol: Out left outlet: The absolute pathname of the file chosen by the user 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.

Examples

Look for folders or a certain kind of file

See Also

Name Description
conformpath Convert paths of one pathtype and/or pathstyle to another
dialog Open a dialog box for text entry
dropfile Define a region for dragging and dropping a file
date Report current date and time
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
folder List the files in a specific folder
strippath Get a filename from a full pathname