DEVONthink TOC for files contained

[Posted this on the Devontechnologies Forum some time ago, but never really got a solution. Since @MacSparky released his Field Guide, thought I’d put it up for discussion here (with a couple of minor modifications).]

I’ve been looking for a way to create a TOC in DEVONthink, but I have had no luck. By TOC, I wasn’t thinking, at least initially, of an Obsidian-style TOC. I just wanted a list of resources I have stored in DEVONthink that I could print out for giving to colleagues, e.g., “Here’s a list of stuff I have. Anything interesting?”

I have many folders and sub-folders in my databases. It is not practical to dig down to the file level in each folder to be able to copy and paste the titles into a text document. I couldn’t see how DEVONthink could accomplish this. Then I thought, “What about Obsidian?” If Obsidian could scan the database and return the title and DEVONthink link, it could create a document that could do this in Obsidian (or even in a mind map app if it could export an OPML). I couldn’t find a plugin in Obsidian that could do this.

The questions I have: 1) Is there currently a way to do this? 2) If not, how difficult would it be to create a plug-in for Obsidian or a DEVONthink automation to do it? I know there are plug-ins that interface with DEVONthink, so that doesn’t seem to be a problem in itself. (Caveat: I know nothing about creating plug-ins and would not even attempt it myself!).

1 Like

There are a couple of ways I can think of in DEVONthink, depending on exactly what you want.

Use the built-in Table of Contents command
The easiest is to collect all the documents you want to include in one place (via searching), then to highlight them all (cmd-a) and choose Tools > Create Table of Contents > As Rich Text (or As Markdown). This will produce a new document with a numbered list of links (no indenting per folder). (Here, the contents of my Sept Journal folder…). This is just a standard RTF (or Markdown) file which you can distribute any way you want.

Collecting all the documents you want to include in the TOC into one view should be fairly simple. E.g. to collect every document in a database, search or use a smart group for “Kind = Any Document” and refine the search from there. (E.g. Kind = PDF etc). Obviously, this approach gives you the most flexibility because Devonthink’s search facility is so powerful: e.g. combine it with conditions for tags, for creation date etc etc to narrow down the list precisely.

Or you could simply go to a top level folder of the database, highlight the list, press cmd-a then cmd-opt-right a few times to expand all subfolders. Then you can use Tools > Create TOC as above.

I’ve just tested both methods out with every document in a database (over 3,000 documents) and it only took a couple of seconds to produce the TOC.

Use the built-in Listing script

The second way is to go to the Scripts menu > Export > Listing. This will produce a plain text listing (no links) of the current database, with folders indented:

Would either of these ways help?

7 Likes

All three of those methods give me a variation of exactly what I want :+1: THANK YOU SO MUCH! The first method even gave me the links I was looking for.

I think I will ask DT if they could consider adding the option to differentiate the group levels, something like headers in markdown. That would make the groups stand out in the TOC…or is there a way to do that now?

Thanks, again, for your help.

Tony

Glad it was helpful!

The first method (Tools > Table of Contents) is built in to the program, so I think DT would have to amend it.

The second is a script, so in theory you should be able to copy and change it yourself to turn the names into markdown links. I’m not very good at AppleScript, sadly so you’re probably better off asking someone who knows what they’re doing…

Brilliant.
Thank you, @brookter.

1 Like