Script to select newly pasted text block

Even with the other great methods, I still do a lot of manual pasting of text blocks taken from other applications into RTF documents within DT. In most cases I do a “Paste with Current Style” and then want to immediately apply a certain format or custom Style. It would be very convenient if the newly pasted text block could be automatically selected, ready to be formatted.

I have a script to do this in BBEdit, example shown below, but I don’t know if the scripting support in DT allows for an equivalent. After looking at the DT scripting dictionary I did some exploring but could not get anything to work. I was trying to set the text property of the selected text Class. Does it also depend on what type of view mode you are in (e.g. the RTF doc in its own window versus the three-pane mode?

Example for “Paste and Reselect” in BBEdit:

set contents of selection to contents of current clipboard

That works even if there is no selection, the cliboard contents are inserted at the current cursor location and the text block remains selected.



Right now it’s only possible to modify the selected text’s attributes but not to select text via AppleScript.

Please consider this for a release in the (not to far) future. I do some text manipulation via AppleScript that work fine with plain text but not with rich text files (In will loose all links if I try). If I could select text via AppleScript I could work around the limited rtf handling of AppleScript.