Questions on linking files in DTP and Bookends

I have two related questions. I have files in two Groups in DTP, both indexing folders in the Mac filesystem: “Archive” and “Attachments”. Where I have dragged files from the Archive folder into Bookends, they will have been duplicated and renamed, with one copy in each Group/Folder.

(i) Is there any way I can go from a PDF in the Attachments Group/Folder to the corresponding entry in Bookends? What I have tried so far is to use a modified version of a script Jim Neumann posted that creates an RTF file for each one of selected entries in Bookends. I can easily modify this so that the file name and file path are included in the file it creates, or in its metadata, but I do not know whether it is possible to go from a PDF in the Attachments Group/Folder to the RTF that contains the name of the attachment. If there is, I could go quickly from PDF to RTF to Bookends.

(ii) Is there any way to make a link between two duplicate files (assuming annotations do not prevent DTP from recognising them as duplicates) so that I can go easily from one to the other? In other words, if a search identifies a file in the Archive that has a duplicate in Attachments, can I go from one to the other? They may both be found by a search but will not be adjacent because they will typically have different filenames.

You may ask, “Why on earth do you want to do this?” I have been using DTP for 8 years, to process PDFs, and have then exported them to Bookends, as attachments, and have been using Bookends to take notes and organise material. The system works but transferring everything into Bookends is so time-consuming I fear I will never finish my project. So I am hoping to make better use of DTP’s search/AI abilities to identify material so I transfer only what I need into Bookends, saving myself a lot of time.

To give an idea of the scale of the data, the “Archive” Group/Folder contains around 69,000 PDFs, there are 26,000 “Attachments” in Bookends, and of these, my guess is that around 20,000 are duplicates. I cannot rename the Attachments without messing up Bookends. I would prefer not to rename the “Archive” files because the sequencing of the files tells me where to find the originals (I went to libraries and photographed documents).

Since posting this, I have realised that the second question is redundant. I can add Label is Not “Entered in Bookends” to my search. The duplicate in Attachments will then be the only PDF found. Sorry I did not think of this before.

Since then I have found the script by Lyndon at A new Bookends –> DT script with a group per reference and I am hopeful that a modified version of this script, using parts of a script by Lyndon Drake, using pieces from another script that Jim Neymann posted for for exporting data from Bookends to DTP, will do what I want. In short, it enable to search simultaneously both references I have processed in Bookends and ones that I have not yet processed, hopefully enabling me to identify which ones need to be processed.