You can change the order of items in the Script menu or assign keyboard shortcuts to scripts by modifying filenames in the scripts folder.
To arrange scripts in a specific order, add a number followed by a closing parenthesis, such as “01)”, at the beginning of the filename. This prefix is used only for sorting and doesn’t appear in the Script menu.
For example:
| Filename | Show in the menu |
|---|---|
| 01)Open File.scpt | Open File |
A file or folder named “-” becomes a separator in the Script menu. You can place it at a specific position by adding a number followed by a closing parenthesis at the beginning of the name (for example, “02)-”).
A file or folder whose name begins with an underscore “_” doesn’t appear in the Script menu. You can use these items for settings files, library scripts, and other supporting resources.
Folders in the scripts folder appear as submenus.
You can assign a keyboard shortcut to a script by adding a period “.”, followed by modifier symbols and a shortcut key, before the file extension.
Shortcut keys are case sensitive. An uppercase letter means the Shift key must also be pressed.
The shortcut key must be a single letter and must come after the modifier keys. You cannot assign non-character keys such as F1 or Delete.
If a shortcut is already used by another function in CotEditor, the shortcut for the script is ignored.
Modifier keys are represented by the following symbols:
| Notation | Equivalent key |
|---|---|
| ^ | Control |
| $ | Shift |
| ~ | Option |
| @ | Command |
For example, the following filenames appear in the menu with these shortcut keys:
| Filename | Show in the menu | Shortcut |
|---|---|---|
| Insert Text.@e.scpt | Insert Text | Command-E |
| 03)Insert Date.@~Y.scpt | Insert Date | Option-Shift-Command-Y |
When multiple scripts share the same keyboard shortcut, CotEditor gives priority to scripts in a subfolder whose name matches the syntax of the current document. This priority updates dynamically as the current document changes.