dropfile Reference

Drag and drop files



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





border [float] (default: 2.)

Sets the size in pixels of the dropfile object's border.

bordercolor [4 floats]

Sets the color of the dropfile border in RGBA format.

folderslash [int] (default: 1)

Toggles adding a slash character ( / ) at the end of a folder name when output is triggered.

rounded [float] (default: 8.)

Sets the amount in pixels by which to round the corners of the dropfile object.

types [64 symbols]

The word types, followed by one or more four-letter filetype codes sets the dropfile object to search for the specified file type(s) and opens a standard dialog window. 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.

Common Box Attributes



When a file icon is dragged from the Finder or Max File Browser 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.


any symbol

Out right outlet: The four-letter filetype code of the acceptable file is sent out the right outlet.


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
Search Paths Search Paths