Reference URL without prefix?


I’m wondering if there is a script that could put on the clipboard the reference URL without the prefix “x-devonthink-item://”. So basically I just want to copy the identifier string, e.g. “D4A0C7EE-44C2-4E31-9D35-1F9090962097”.

The reason for this is that some applications need an additional forward slash in the prefix in order to understand the link, and I want to be able to add that extra forward slash in the same script that copies the URL instead of doing it manually.

This is how I would (mostly) approach this…

tell application id "DNtp"
	set sel to (item 1 of (selection as list))
	set the clipboard to (do shell script "echo " & (reference URL of sel) & " | sed 's_//_///_g'")
end tell

Note: this is not error-trapped. It is a core fragment of how I would handle the requirement, not a full script (ie. this will error if there’s no selection, and yes, I am leaving that part intentionally blank. :smiley: )

set the clipboard to the uuid of the content record as string

UUID is the unique identifier of a record and thus the numeric portion of the Reference URL. The content record is the current selected record.