Take a look at A script library to get the path of the frontmost document
And maybe this Script: Open DEVONthink record for PDF Expert tab