Script: Make "Nisus Compressed Rich Text" records searchable by text content

Hi there,

as written in this tip I only use Nisus Writer with “Nisus Compressed Rich Text” files to prevent (accidental) loss of Nisus styles.

“Nisus Compressed Rich Text” records are only searchable by name as DEVONthink (and other apps) can’t look inside the archive.

With this Smart Rule script it’s possible to make Nisus Compressed Rich Text records searchable by text content.

In the Smart Rule set Suffix to ZRTF (Nisus Compressed Rich Text)

-- Set finder comment to plain text of "Nisus Compressed Rich Text" record and thus make it searchable in DEVONthink 3
-- CAUTION: script overwrites existing finder comment!

on performSmartRule(theRecords)
	tell application id "DNtp"
			repeat with theRecord in theRecords
				if kind of theRecord = "Nisus Compressed Rich Text" then -- (depends on language I think)
					set thePath to path of theRecord
					set plainText to do shell script "gzip -c -d " & quoted form of thePath & " | textutil -stdin -convert txt -stdout"
					set comment of theRecord to plainText
				end if
			end repeat
		on error error_message number error_number
			if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		end try
	end tell
end performSmartRule

What’s the extension of these files? Or could you send such a file to cgrunenberg - at - Then it’s very likely that an upcoming release could directly support this.

Extension is *.zrtf, also sent a mail. Do you know if the finder comment has a length limit? Then I could change “plainText” to the limit

DEVONthink’s internal comment is unlimited, the Finder comment is limited to 256 characters (or bytes?) but this shouldn’t matter in this case.

Does this mean the comment (as used in the script) is unlimited but if the record were exported it would be cut after 256 characters?

That’s correct.