DTPO gives you the option of building Spotlight-visible metadata for its databases. It’s stored in:
“/Users/…/Library/Caches/Metadata/DEVONthink Pro 2/” by the UUID of the database, and then by the uuid of the database record, plus a “.dtp2” extension (approximately).
It’s some work keeping all those 31-character file and folder names in your head, so the following script will retrieve the Spotlight metadata for a file selected in the database:
tell application "DEVONthink Pro" set metadataUUID to uuid of (selection as reference) & ".dtp2" set databaseUUID to uuid of database of item 1 of (selection as reference) end tell set spotlightData to "" tell application "Finder" set fullPath to a reference to (home as string) & "Library:Caches:Metadata:DEVONthink Pro 2:" & databaseUUID set metadataFolders to folders of folder fullPath repeat with i in metadataFolders set metadataFiles to files of i repeat with j in metadataFiles set filePath to (name of j) if metadataUUID = filePath then set filePath to POSIX path of (i as string) & filePath set spotlightData to do shell script "mdls " & "\"" & filePath & "\"" end if end repeat end repeat end tell set result to spotlightData
Caveats: I’m using this with Keyboard Maestro, which has a nice text window to display the results. You’ll have to fiddle to get it to create a text record in DTPO, or whatever you might need, if you don’t have a similar setup.
Works for a selection of one item, no error checking if you do otherwise.
Only briefly tested (works for me!). And as usual, back up your precious data, and don’t throw blames if you go down in flame.