Tinderbox Forum

Scanning DEVONthink notes and detecting their links

I spent the weekend evaluating Tinderbox to see if it would fit my research workflow, which is currently heavily dependent on DEVONthink — I have some hundreds of Markdown notes stored in it. When I discovered the AutoFetch feature, I realized I could use it as an extraordinary tool for analysis without breaking my current infrastructure, particularly with the Map View.

But then, it would be a requirement to reproduce and maintain the mesh of links already in existence between my notes. My understanding is that there isn’t such a feature built into Tinderbox to detect those references and create the links between TBX notes. Studying the documentation, I was able (after a few long hours!) to produce this piece of code, which I am currently using as a Stamp for testing:

if($Text.contains("x-devonthink-item://")){ $MySet =; $MyList=runCommand($Text("extract-dtp-links"), $Text); $MyList.each(x) { $MySet = $MySet + find($URL.contains("x-devonthink-item://" + x)); } ; linkTo($MySet); $Color="red" }
It is coupled with the shell command stored in “extract-dtp-links”:

sed -n 's|^.*x-devonthink-item://\([A-Z0-9-]\{36\}\).*$|\1|p' | tr '\n' ';' | sed 's/;$//'

Et voilà! I was able to see some of my notes beautifully linked (I still can only see some of them with my unregistered copy of TBX while I wait for my order to processed…).

My question then is the following: isn’t calling a shell command a performance killer in the long term? I’d certainly like to automate the process with an Agent or Edict, but I don’t know how it is going to behave with hundreds or maybe thousands of 200-word notes. Is there a built-in procedure for scanning $Text, different from the .contains() method, returning e. g. a List or a Set of occurrences that could be internally evaluated using regular expressions?


Very clever – I hope your order comes through soon because you’re going to be unstoppable :sunglasses:

“Performance killer” – it will depend on how frequently you need to do this link retrieval procedure. Will your notes continue to be linked in unpredictable ways, on the one end of the spectrum, or are the inter-note linkages contained within each batch you import and you will not be doing the retrieval more often? If the former, then you’ll want to consider an edict or your stamp. If the latter, then you might build the routine into a OnAdd action for the important container, or an agent, and it’s once-and-done.

No. The only options are are case-sensitive String.contains() and a case-insensitive String.icontains() functions but these are both regex based. I’ve not time to test this moment but I think your shell script could be done in Tinderbox using chained commands $Text.contains().replace(), etc. Even so as you’ve rightly considered, performance might become an issue. I’d agree with the previous answer above on that score.

Edit: autocorrect re-correction mat -> might, which may make the penultimate sentence more understandable!