Is this a terminology clash, or a bug?

Browse the dictionaries of various applications. You’ll notice that “text” is enumerated in several scripting additions and application dictionaries. However “txt” is enumerated specifically for DEVONthink for identifying a textual record type – but not exclusively since “markup” and other types can be used for plain text as well. IOW – if you want to test for any plain text you need to use all of the plain text enumerations – see “Type2” in the dictionary.

You’re right about some of the discontinuities – it’s a annoyance of AppleScript’s flabby definitional structure and heritage.

BTW, you script will abend at the third line. Use this


tell application id "DNtp"
	if not (exists content record) then error "Please open a document."
	set refDocument to the content record
	-- not using 'kind' because it may be localised
	if type of refDocument is in {text, txt, rtf, rtfd} then
		-- do stuff to this document
	end if
end tell