Insert URL into note body

Hello,
I’m using the web clipper and it’s working fine, but I’d like to have access to the URL when I’m accessing the rtf on other devices (indexed to Dropbox).

To achieve that, I’d like to insert the documents ‘URL’ (ie: google.com) into the note body.

Something like this:

http://google.com

Clipped content here

It would be handy to do this with a script. It’s no big deal for it to be a second step to the web clipping. Any ideas?

Thanks,

  • David

This script inserts the URL into multiple selected text or RTF(D) documents. 3-pane, split or columns view is required:


tell application "DEVONthink Pro"
	set theWindow to think window 1
	copy the selection of theWindow to theSelection
	repeat with theRecord in theSelection
		if type of theRecord is rtf or type of theRecord is rtfd or type of theRecord is txt then
			set theURL to URL of theRecord
			if theURL is not "" then
				set the selection of theWindow to {theRecord}
				tell text of theWindow
					make new paragraph with data (theURL & return & return) at beginning
				end tell
				tell theWindow to save without asking
			end if
		end if
	end repeat
end tell

Works perfectly!!!

This is also a nice script to learn the basics of editing a document.

Thanks again,

  • David

Can you briefly explain why this and other scripts you’ve posted sometimes require certain views? Thanks.

In this case the displayed (rich) text (“tell text of theWindow”) is scripted and therefore icon/list views aren’t supported. Another issue in this case is that the script modifies the selection and therefore document windows aren’t supported either.

That all makes sense - thanks!