Script for opening an indexed file or folder/group in DEVONthink from an external app (e.g., Finder, Alfred, HoudahSpot, etc.)?

@pete31 - Thanks for your help. Ironically, your PDF Expert script was super helpful for fixing a different issue. I created a far more simplistic version of your script a few years ago to work with Alfred for shifting between active PDF documents (PDF Expert, Preview, Adobe Acrobat). I could never figure out how to do it efficiently with PDF Expert (because of its lack of Apple Script support) without running it through Alfred’s search, which never worked particularly well (because it was GUI-based). In any case, your solution with PDF Expert was genius (LSOF - etc.)! It completely solved that problem. Now that script works amazing!

As for this issue, while I’m probably overlooking something, it’s the later part of the problem that I’m struggling with (i.e., how to reveal what you’ve found). Instead of opening the file in DEVONThink, how do I consistently reveal it in the same active window (without opening a new window)? The script that I posted above works in most situations, but will sometimes select the file from the sidebar if its group is located in the Tags or Favorites sections (not the Open Databases section, where it should). Any ideas how to get it to reveal the file or group (instead of open it)?

Thanks again to everyone for all of their help!