Create multiple items from a list? Create a single item from an indexed folder?

Hi, All - I’m at that stage in using DT where I realize that my current system…could work better. I have years of stuff in places, and while it can all be searched, it’s a bit out of control.

I have two questions, and fear I may just be facing manual work to correct choices I made previously. Which isn’t the end of the world, but it seems worth checking first. I imagine some of this might be scriptable, but if so, it’s beyond my abilities, but it would be good to know if it’s even possible.

Basically, I have lots and lots of raw data, but need an abstraction layer, where I can consolidate some of my notes and links to things about each object.

  1. I have a text document that is basically a list of several hundred things (the shelf marks of medieval manuscripts). Is there any non-manual way to create several hundred RTF items in DT from that list?

  2. I have indexed folders (of images of medieval manuscripts). Is there any way to create an RTF item from the name of each of the folders? I can get fancy and place a link back to the indexed folders manually.

Many thanks.

As you said: that can be scripted. If the relevant text is ready to recognize because each one is on its own line or is enclosed with markers or…

But I’m wondering what you’d want with several hundred of empty RTF files.

Edit: Elaborating on that early morning answer.

/* Sample script in JavaScript */
(() => {
  const app = Application("DEVONthink 3");
  /* Take the selected record as the one containing the shelf marks */
  const textDoc = app.selectedRecords()[0];
  /* Get the UUID of the group you want the RTFs to store in in the quotation
     marks below instead of the xs. 
     You get the UUID by selecting the group and then "copy link" from the context menu.
      The UUID is the part _after_ "x-devonthink-item://" 
  const targetGroup = app.getRecordByUuid("xxxxx");
  /* Assume textDoc contains one shelf mark per line, separated by newlines */
  const shelfMarks = textDoc.plainText().split('\n\n');
  shelfMarks.forEach(sm => app.createRecordWith({name: sm, type: "markdown"}, {in: targetGroup}));

Note This code is not tested at all. It comes without warranty or promise of doing anything useful at all.

By folder, you mean group, I guess? And yes, that’s also feasible with a script.

Thank you so much. I think with some (careful) tinkering, I can use this. As far as empty items, this was the first step. The master list file also has two other pieces of data (where my physical notes are, whether there are photos), and I may be able to extend the script to populate the RTFs with those.

Yes, groups. My mistake.

Again, thanks for this.

While that’s possible with a script, it’s a pita because of the RTF format. Markdown would be a lot easier to generate.

  • Can you post an example of a few lines in the text file?
  • Can you post what the group with the RTF file would look like?

The text file basically consists of entries like the following, which is basically a unique identified (“Additional 17920”) to be used as the name of a DT item, and then one or two data I will ultimately want to get into each item (Numbered or lettered physical notebook identifiers, sometimes “Photos”). The list wasn’t designed for this, so it’s going to need some cleaning, but I’m not too worried about that…

Additional 17920 D
Additional 18010 A
Additional 18160 A
Additional 18457 13
Additional 19052 A
Additional 19677 4
Additional 25013 Photos
Additional 29759 A. Photos.

Each group contains indexed folders, and I want to create a single RTF document from the name of group (ideally then containing a link to the folder):

Again, many thanks.

You’re welcome :slight_smile:

So what for example is in BL 7-02 Stowe 38?

3 jpg files, all photographs of that manuscript. Or, 114 JPGs of Harley 1004.

Basically, I have 20 years of physical notes, 10 years of photographs, and 10 years of digital notes that have been migrated into DT in various ways.

I’m struggling to organize work I’ve already done. By creating an individual note per manuscript, I can aggregate old work I’ve done in a single place, and consolidate links to newer notes, links to manuscript catalog entries, etc. in a single place.

But do the files in that group have the group’s name? That’s what you appeared to be saying earlier.

Ah, no. All the files have different random names. Which is fine - I have no need to rename the constituent files in the group, just have an item that can share the name of the group.

Can you open a support ticket to discuss this a bit more?