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

**URL:** <https://discourse.devontechnologies.com/t/put-html-link-s-to-selected-document-s-on-the-clipboard/16618>\
**Category:** Automation\
**Created:** [November 6, 2013, 2:30pm UTC](https://discourse.devontechnologies.com/t/put-html-link-s-to-selected-document-s-on-the-clipboard/16618 "2013-11-06T14:30:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![korm](https://discourse.devontechnologies.com/letter_avatar_proxy/v4/letter/k/e0b2c6/32.png) [@korm](https://discourse.devontechnologies.com/u/korm)\
**Post date:** [November 6, 2013, 2:30pm UTC](https://discourse.devontechnologies.com/t/put-html-link-s-to-selected-document-s-on-the-clipboard/16618/1 "2013-11-06T14:30:49Z")

</div>

This is a riff on the [RTF-links script](https://discourse.devontechnologies.com/t/put-rtf-link-s-to-selected-documents-on-the-clipboard/16617/1).

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.

```auto
(*
	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

```

---

<div class="post-metadata">

**Author:** ![system](https://devontech-discourse.s3.dualstack.us-east-1.amazonaws.com/uploads/original/2X/4/4e6ff70c96be2eb307a274d890bba8d71ba671b3.png) [@system](https://discourse.devontechnologies.com/u/system)\
**Post date:** [January 21, 2022, 11:20am UTC](https://discourse.devontechnologies.com/t/put-html-link-s-to-selected-document-s-on-the-clipboard/16618/2 "2022-01-21T11:20:18Z")

</div>

Closed on January 21, 2022, 11:20am UTC


