Put HTML link(s) to selected document(s) on the clipboard

This is a riff on the RTF-links script.

In this script, the thing on the clipboard is an HTML snippet. This one is useful to me because I want to paste links to things in my databases to TheBrain – and that app does not play well with RTF pasting in the OS X version.

(*
	Put HTML link(s) to the selected records (or groups) in DEVONthink onto the cliboard
	For pasting to another document or HTML-text aware location.
	
	v1.20131106.korm
*)

tell application id "com.devon-technologies.thinkpro2"
	try
		set theSelection to selection
		if theSelection is {} then error "Select an item, please"
		
		set o_HTML to ""
		
		repeat with thisItem in theSelection
			
			set thisName to the name of thisItem
			set thisURL to the reference URL of thisItem
			
			set o_HTML to o_HTML & "<p><font face=\"helvetica\"><a href=\"" & thisURL & "\">" & thisName & "</a></font></p>"
			
		end repeat
		
		set the clipboard to o_HTML
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
	
end tell