Support different CotEditor versions in AppleScript

This page lists the previous specific changes on AppleScript support in CotEditor.

Terminology change on CotEditor 5.0.7

Improve write to console command

Add title and timestamp options to the write to console command, so that the script name and timestamp can be omitted when writing to the console programmatically.

Terminology change on CotEditor 5.0.0

Change character range unit to grapheme cluster based

Change the character unit, used in selection or jump for instance, from UTF-16 based to the Unicode grapheme cluster-based. This is to follow the specification change in AppleScript 2.0 introduced in Mac OS X 10.5.

Terminology change on CotEditor 4.4.0

Deprecate length

The length property for the ‘document’ object was deprecated.

For backward compatibility, CotEditor 4.4.0 still accepts using this property; however, it can be removed someday in the future without announcement.

Delete backward compatibility of path

The path property, which was deprecated in CotEditor 2.0.0 but stealthily kept for backward compatibility, is completely deleted in this version.

Terminology change on CotEditor 4.1.0

Jump

A new command jump was added to the ‘document’ object.

Support encodings with BOM

A new property has BOM was added to the ‘document’ object.

A new option BOM was added to the convert command.

Terminology change on CotEditor 4.0.7

Encoding convert / reinterpret

Now convert and reinterpret commands accept the encoding also in the IANA charset name.

Terminology change on CotEditor 3.9.7

Smart quotes

The following new commands were added to the ‘selection’ object.

Terminology change on CotEditor 3.5.0

Editor’s opacity

view opacity property was deprecated on CotEditor 3.5.0.

Note that there is no backward compatibility with this change.

Terminology change on CotEditor 3.1.2

Auto tab expansion

A new property expands tab was added to the ‘document’ object.

Terminology change on CotEditor 2.6.0

Line spacing property

line spacing property was deprecated on CotEditor 2.6.0.

Note that there is no backward compatibility with this change.

Terminology change on CotEditor 2.5.3

Unicode normalization

A new value Modified NFC was added to the normalize unicode command.

Terminology change on CotEditor 2.3.0

Selected line editing

The following new commands were added to the ‘selection’ object.

Terminology change on CotEditor 2.2.2

Unicode normalization

A new value Modified NFD was added to the normalize unicode command.

Terminology change on CotEditor 2.2.0

Unicode normalization

A new value NFCK Casefold was added to the normalize unicode command.

Terminology change on CotEditor 2.1.0

Tab width

A new property tab width was added to the ‘document’ object.

Terminology change on CotEditor 2.0.1

Comment handling

New commands comment out and uncomment were added to the ‘selection’ object.

Terminology change on CotEditor 2.0.0

Unicode normalization

The command unicode normalization on CotEditor 1.x was renamed on 2.0 to normalize unicode. The function and parameters are the same as before.

Note that there is no backward compatibility with this change.

Discontinuation of path property

The path property of ‘document’ object is discontinued on the modern AppleScript’s Standard Suite for a long time. Since CotEditor adopted it on version 2.0, this property is also deprecated on CotEditor. Use new file property instead. While path property returns a text object, file property returns a file object.

For backward compatibility, CotEditor 2.0 added a hidden path property to ‘document’ object uniquely; however, do not use it if you create new scripts and we also recommend migrating your previous scripts to use file property. Because this `path` property can be removed someday in the future without announcement.

Update of internal code for range property

The internal code for range property of the text selection object to identify itself has been changed on CotEditor 2.0. The key for the range property is still range, so you don’t need to care about this if you write a new script. However, compiled AppleScripts (.scpt) which were written previously might need some updates for this change.

How to fix:

Open your .scpt files on AppleScript Editor (or Script Editor), the words that were range previously might be changed to «class prng» or something like that. Overwrite them with range again. And save them.
This issue doesn’t occur with plain-text AppleScript (.applescript).

Terminology change on CotEditor 1.5.0

Window transparency

According to the changing of the mechanism to make the window transparent on CotEditor 1.5, the terms about window opacity for AppleScript were also changed. The document’s properties till on version 1.4:

were deprecated, and the new window’s property:

was added instead.

Because the previous term “transparency” was incorrectly used until version 1.4, the property name was renamed from “transparency” to “opacity” but the value to set is not changed. Namely, 1.0 means fully opaque on both properties.

Note that there is no backward compatibility with this change.

Selection object directly under the application

In version 0.6, the initial release of CotEditor, if you didn’t specify the ‘selection’ object, the frontmost window’s contents are selected. But it actually didn’t work correctly and therefore deprecated. This method was kept valid however to maintain backward compatibility.

On CotEditor 1.5, it is formally removed. Specify the target like below, when you get the ‘selection’ object.

example 1.
tell application "CotEditor"
	contents of selection of front document
end tell
example 2.
tell application "CotEditor"
	tell document 1
		contents of selection
	end tell
end tell

See also