Constructing Item Link?

Hi,

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:

x-devonthink-item://ffeb5ac2369121bc258e78163f6749c2@async.facebook.com

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

x-devonthink-item://%3Cffeb5ac2369121bc258e78163f6749c2@async.facebook.com%3E

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

Thanks,
Tom

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.

Tom