Quick and Dirty Print Script

Here’s a small script I threw together to print a text file (.txt or .rtf) from DevonThink Pro through TextEdit. The resulting document has margins. Maybe someone skilled in scripting TextEdit could improve the formatting, but this works for me.

To use it, just select the entry in DTP (the name only - you don’t need to select the text) and execute the script. It will send the the text to TextEdit, print and then quit TextEdit.

Hope it is useful. Please reply with any improvements/suggestions. Thanks.

property this_subject : “”
property this_text : “”

tell application “DEVONthink Pro”
set this_selection to the selection
set this_subject to the name of item 1 in this_selection
set this_text to the rich text of item 1 in this_selection
end tell

tell application “TextEdit”
set tmDoc to make new document
set the text of tmDoc to this_text
print tmDoc
quit saving no
end tell

First of all: Thanks for this effort. Printing text from DT is really a mess, and it is a good idea to implement a script.