Create insertion formats for File Drop in CotEditor on Mac

By using variables in File Drop insertion formats, you can insert text that reflects information about the dropped file.

The following variables are available in File Drop insertion formats:

VariableDescription
<<<ABSOLUTE-PATH>>>

The absolute path of the dropped file.

<<<RELATIVE-PATH>>>

The relative path from your document to the dropped file.

<<<FILENAME>>>

The name of the dropped file including its extension.

<<<FILENAME-NOSUFFIX>>>

The name of the dropped file without its extension.

<<<FILEEXTENSION>>>

The file extension of the dropped file.

<<<FILEEXTENSION-LOWER>>>The file extension of the dropped file in lowercase.
<<<FILEEXTENSION-UPPER>>>

The file extension of the dropped file in uppercase.

<<<DIRECTORY>>>

The name of the directory containing the dropped file.

<<<FILECONTENT>>>

The text contents of the dropped file (available only when the dropped file is a text file).

<<<IMAGEWIDTH>>>

The width of the image (available only when the dropped file is an image file).

<<<IMAGEHEIGHT>>>

The height of the image (available only when the dropped file is an image file).

Create an insertion format

You can create snippets for different purposes, such as the following examples. The inserted text varies depending on the dropped file.

When a file named “example.html” is dropped:

Insertion formatText actually inserted
<a href="<<<RELATIVE-PATH>>>"></a> <a href="example.html"></a>

When a file named “example.jpg” is dropped:

Insertion formatText actually inserted
<img src="<<<FILENAME>>>" width="<<<IMAGEWIDTH>>>" height="<<<IMAGEHEIGHT>>>" /> <img src="example.jpg" width="160" height="80" />

See also