Now I am thinking that it must be possible to copy the title of an item along with the link. And since I do not see any option to do so in the DT interface, I am assuming that this will only be possible by invoking a script.
It is not a built-in feature to put title+link on the clipboard, but this is the script I use to do that. The clipboard will contain a rich-text link – so it needs to be pasted into a RTF document. To use the script, copy the text inside “Code” below. Open Script Editor, paste the text, compile, and save it to a personal folder inside
/Users/Dakota/Library/Application Support/DEVONthink Pro 2/Scripts
-- with reference to http://macscripter.net/viewtopic.php?id=26498
-- this will put a link on the clipboard to the current document (or group) selected in DEVONthink
tell application id "DNtp"
set o_URL to (the reference URL of (the first item of (selection as list)) as string)
set o_Text to (the name of the content record of think window 1)
set o_HTML to quoted form of ("<font face=\"helvetica\"><a href=\"" & o_URL & "\">" & o_Text & "</a></font>")
do shell script "echo " & o_HTML & " | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf"
end tell
This is great. Just what I needed. I have made a slight modification to make it work for markdown. I did not know what you were doing in the shell script portion aside from echo, but I did not touch that and it still works for Markdown.
So big thanks!
Here is the slightly modified version that I am using.
-- with reference to http://macscripter.net/viewtopic.php?id=26498
-- this will put a link on the clipboard to the current document (or group) selected in DEVONthink
-- with reference to https://discourse.devontechnologies.com/t/possible-to-copy-title-of-an-item-along-with-the-link/20910/1
tell application id "DNtp"
set o_URL to (the reference URL of (the first item of (selection as list)) as string)
set o_Text to (the name of the content record of think window 1)
set o_HTML to quoted form of ("[" & o_Text & "]" & "(" & o_URL & ")")
do shell script "echo " & o_HTML & " | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf"
end tell
The Markdown version of this is actually simpler than the proposal.
tell application id "DNtp"
set theItem to (the first item of (the selection as list))
set the clipboard to "[" & name of theItem & "](" & reference URL of theItem & ")"
end tell
Just a suggestion, but when revising scripts it’s best not to leave extraneous code in place – it can create a future failure point if that code becomes unsupported by the AppleScript parser. The code you left behind is what’s used to put RTF-styled text on the clipboard by using a call to textutil. It’s of course not needed when producing plain text results.