Script to reformat rich text documents

Here’s another simple script demonstrating how to reformat multiple selected rich text documents. The example changes line spacing, font, size and alignment. Please note that the script does not modify the modification date of the documents.


tell application "DEVONthink Pro"
	try
		set theSelection to the selection
		if theSelection is {} then error "Please select some records."
		repeat with theRecord in theSelection
			set theDate to the modification date of theRecord
			set theWin to open window for record theRecord
			tell text of theWin to set {line spacing, font, size, alignment} to {1.0, "Courier New", 14.6, left}
			close theWin with saving
			set the modification date of theRecord to theDate
		end repeat
	on error errText
		display dialog errText
	end try
end tell