Skip to content

Instantly share code, notes, and snippets.

app = Application("CotEditor")
app.includeStandardAdditions = true
doc = app.documents()[0]
function replaceSelectedText1(newText) {
selectedRange = doc.selection.range()
if(!selectedRange[1]){
// omit
return newText
}