Constructing Item Link?


I’ve been trying to mimic the behaviour of “Copy Item Link”. I usually contruct an item link with this code:

repeat with theSelectedRecord in theSelection
	set theUUID to uuid of theSelectedRecord
end repeat

set theItemLink to "x-devonthink-item://" & theUUID

This works very well for rtf files and the like. But its a total fail for emails in DEVONthink on my system.

For instance, this code yeilds the following “Item Link” for one email on my system:


The actual link to the email item as obtained by “Copy Item Link” is:


Any suggestions for making my construction look like the actual link would be greatly appreciated.


Could be simplied, but this does it for me. “Reference URL” was introduced a while back to eliminate the need for a do-it-yourself URL-making routine.

tell application id "com.devon-technologies.thinkpro2"
	set the clipboard to the (reference URL of the first item of (selection as list) as string)
end tell

That’s fantactic. Thanks for the quick response.