Request for script – Copy selected text and add document nam


I apologise for making this sort of request, but after quite some time trying to work out and failing to grasp even the basics of applescript, I wondered whether anyone could help. I’m after a script to copy selected text in an RTF file in DT to the clipboard that can add the name of the document it is quoted in, so that when you paste in another RTF document, you get not only the quotation, but also a line with the name of the document you copied it from – so that DT can make a wikilink back.

So, for example, if one had a document called ‘Wodehouse-Psmith.rtf’, containing:

And one copied something from the quotation above using this script, one could paste:

I suppose I’m thinking of something rather like a simpler version of gts’s fantastic QuoteHighlight&Annotate script, but which would not create a new file from a template, but rather let one paste the information wherever one wanted.

I would be very grateful if someone could help, or point me in the right direction.

Best regards,


Here you go:

-- the use of this script is as described by juan.cobo in

tell application id "com.devon-technologies.thinkpro2"
	set theText to the selected text of think window 1
	set theName to the name of the content record of think window 1
	set the clipboard to theText & " (From: " & theName & ")"
end tell

Very nice concept, Juan. Thanks for pointing it out.

That’s fantastic! Thank you for your help, and for your extremely quick reply.

I hope others find it useful too. I first learned of DT through a friend, who wrote this post: … geekery-i/

I was particularly attracted by the possibility of collating chunks of my notes and various texts into ‘notebooks’, for when it came to outlining and planning writing projects. Whilst being able to turn quotations into separate files that you can rearrange and play around with is very useful, I also wanted to be able to do this within a single document, and after discovering wikilinks found myself doing this manually, and thinking that there must be an easier way. This is perfect!

Thanks again!