You can change the order of scripts in the Script menu or assign keyboard shortcuts to scripts by modifying their 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 insert the separator at a specific position by adding a number followed by a closing parenthesis at the beginning of the folder name (for example, “02)-”).
A file or folder with a name that begins with an underscore “_” doesn’t appear in the Script menu. You can use these items to store settings files, library scripts, and other supporting resources.
A script placed inside a folder within the scripts folder appears as an item in a submenu.
You can assign a keyboard shortcut to a script by adding dot “.” followed by modifier keys and a shortcut key before the file extension.
Shortcut keys are case sensitive. An uppercase letter means the Shift key must also be pressed. See the examples below to see how it works.
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 in the following symbols:
| Notation | Equivalent key |
|---|---|
| ^ | Control |
| $ | Shift |
| ~ | Option |
| @ | Command |
For example, given the file names, the script names that appear in the menu and the shortcut keys assigned to them would be as follows:
| 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.