Is this a terminology clash, or a bug?

I think I have run into a terminology clash with “text”.
This term occurs in the text suites but also as a constant in the ‘type’ property of a record.
The dictionary says the type of a plain text document is “txt”, but when asked DTP tells me it’s “text”.
I’m running 2.7.6.

This kind of thing will not work with a plain text document:```
tell application id “DNtp”
if not (exists content record) then error “Please open a document.”
set {refDocument} to selection
– not using ‘kind’ because it may be localised
if type of refDocument is in {text, rtf, rtfd} then
– do stuff to this document
end if
end tell

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