CotEditor has a scripting feature that lets you run your own scripts on CotEditor to manipulate documents or launch external programs. Your scripts are shown in the Script menu represented with .
On CotEditor, there are two different ways to write scripts:
While AppleScript (incl. JXA; JavaScript for Automation) can control CotEditor’s document more flexibly, UNIX scripts can only modify the contents of the frontmost document. However, as for UNIX scripts, you can write them in various languages, such as Python, Ruby, Perl, and so on. Choose a script type that suits your use. For details about how to write your scripts, refer to Script CotEditor with AppleScript or Script CotEditor with UNIX script.
To add scripts to or remove scripts from the Script menu, follow the instruction below:
You can change the order of scripts or assign keyboard shortcuts by modifying the names of your script files. See Customize the Script menu for the details.
The CotEditor project provides some sample scripts. You can get them on:
coteditor/SampleScripts -GitHub
Some users may distribute their scripts for CotEditor online. Some of them are listed on:
CotEditor Scripts -CotEditor Wiki