I am trying to build a custom script based on ~/Library/Application Scripts/com.devon-technologies.think/Smart Rules/Download Bibliographic Metadata.scpt . This script is what powers the “Download Bibliographic Data” smart rule.
The comments in the script suggest that it parses the PDF passed to the script and searches for a DOI string. But the actual code does not look at all like a parser, but as if there was some metadata extraction going on already within DEVONthink:
try
set customMetaData to custom meta data of theRecord
set doi to mddoi of customMetaData
[...]
on error
set doi to ""
try
set doi to digital object identifier of theRecord
… and that’s it.
What is “custom meta data” and “digital object identifier of theRecord” here, how is it filled within DT, and where can I read more details about this in the documentation?
Many thanks in advance!
Custom metadata is arbitrary metadata assigned to an item in the database, defined in the Settings > Data, and accessed via the Info > Data inspector. There is a built-in attribute that may have data in it…
If none is found, the script looks for the digital object identifier in the properties of the record. Not all PDFs have them.
tell application id "DNtp" to return the digital object identifier of (selected record 1)
--> 10.3233/JAD-240069
… from this PDF…
Thanks for your quick reply! However, I still don’t get how that custom metadata field is populated in the first place. I see a DOI even for files that I only ever imported into the database and which I did not touch since then. Does DEVONthink analyze document metadata right on import?
PDFs can contain a DOI, and I suppose DT sets that property during import, if it finds a DOI.
1 Like
No, the DOI custom metadata isn’t set automatically. It requires user intervention, via some automation, usually e.g., a smart rule.
This is a built-in smart rule.
When run on a PDF with a DOI, it yields results like this…
1 Like