Remove blank lines in RTF

I’d like to add to a general reformatting script for RTF files to remove blank/empty lines. Any suggestions?

One possibility would be to use WordService’s “Reformat” service or the similar AppleScript command “reformat” of DEVONthink’s text suite. If the result isn’t the desired one, then you have to script visible rich text at the moment, e.g. here’s an old script:

tell application id "DNtp"
	tell text of think window 1
		set i to 1
		set cnt to number of paragraphs
		repeat while i ≤ cnt
			if length of ((text of paragraph i) as string) is 1 then
				set text of paragraph i to ""
				set cnt to cnt - 1
				set i to i + 1
			end if
		end repeat
	end tell
end tell

This is perfect. Many thanks!