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


Define a region for dragging and dropping a file


dropfile defines a region for dragging and dropping files into and then outputs the filepath and filetype upon file input.




(drag) When a file icon is dragged from the Finder onto a dropfile object in a locked patcher window, the object checks the file's type against those that it has been told to accept. If the file is of an acceptable type, the outline of the dropfile box is highlighted. If the mouse button is released while the cursor is inside the dropfile box, the dropfile object outputs the type and full pathname of the file out its outlets.


Name Type g/s Description
border float
Sets the size in pixels of the dropfile object's border.
bordercolor float Sets the color of the dropfile border in RGBA format.
folderslash int
Toggles adding a slash character ( / ) at the end of a folder name when output is triggered.
rounded float
Sets the radius, in pixels for the dropfile object.
types symbol Sets the file types that will be accepted by the dropfile object. Example type codes for files are TEXT for text files, and AIFF for AIFF format audio files. types with no arguments makes the object accept all file types, which is the default setting.

Information for box attributes common to all objects


any symbol: Out right outlet: The four-letter type code of the acceptable file is sent out the right outlet.
symbol: Out left outlet: When an acceptable file icon has been dragged onto dropfile and the mouse released within its box, the absolute pathname of the file is sent out as a single 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.

When aliases of folders are dragged onto dropfile, the aliases are resolved to create the output path.

If you want to use the dropfile object to cause a file to be read by another object that accepts the read message with a filename argument, put a prepend read object between dropfile and the object that will open a file, as shown in the example.


See Also

Name Description
absolutepath Convert a file name to an absolute path
relativepath Convert an absolute to a relative path
strippath Get a filename from a full pathname
opendialog Open a dialog to ask for a file or folder