dropfile

Description

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

Arguments

None.

Messages

(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.

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.

Output

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.