Get name of record through UUID?

Hi,
I’m trying to get the name of a document using its UUID but can’t get it to work. Is it possible?


set sourceRecord to get record with uuid (sourceURLid)
set sourceTitle to name of sourceRecord

Works for me. I wrapped your code as follows, but that was just for testing your code and is not a change to your logic:

tell application id "DNtp"
	set sourceURLid to "B707A9E7-267C-449E-A156-8E2AD4340293"
	set sourceRecord to get record with uuid (sourceURLid)
	set sourceTitle to name of sourceRecord
end tell

It’s working for me too.

name of (get record with uuid "52082F98-A21D-4EAB-B8CA-70B17D687F94")

Ah, it was a problem with the UUID variable. Sorry.

While getting the name works, getting the URL does not?


set sourceURL to the URL of (get record with uuid (sourceID))

Not every record has a value for the “URL” property. The “URL” property is what appears when you look at the URL box in Show Info. The URL of a bookmark, for example.

Are you looking for the “x-devonthink-item://…” link? That’s called the “Reference URL”. But, if you know the UUID then you already know the value your need.

Yeah, it’s the URL property I’m after and the sourceID document has one. But the line posted above aborts the script.

Not here. As long as sourceID is defined ahead of the line you posted, and defined with a valid UUID as a string, the script over here works as expected – the URL of the record is returned.

Thanks, works now.