Creating clickable links in Finder to DT docs or folders (Mac)

I am a returnee, trying to figure out a best workflow. I anticipate continuing to maintain a finder folder structure outside of DT and then also having a structure of folders in DT to correspond to particular projects (e.g. for notes, email capture, and smaller documents). What I’d like is to put a link in my finder folder for a project to correspond to the particular corresponding folder in DT for that project.

I see how to get the link to a DT folder or file. But I can’t paste this directly into the Finder project folder (like I could for example by dragging a link from Safari). Obviously I can paste the DT link into a text document to put in the finder, though this is a bit of a kludge. Am I missing something?

(I see I can paste the link into Safari, then Drag and Drop from Safari - but that requires an extra step)

DT does not have folders, it has groups. That sounds pedantic, but folders are objects in the operating system, and groups are not. Using the right terminology helps to understand things better, I think.

If you save a “real” URL (as opposed to an x-item-devonthink one), you’ll get a webloc file. If you save the x-item-devonthink URL, you’ll get an inetloc file.

Aside: It is really embarrassing to see that Apple relies on extensions for functionality. If they knew what they were doing, they’d look at the content and use one extension.

Both are essentially the same kind of plist. So, you can easily create it with a script like this:

(() => {
  const app=Application('DEVONthink 3');
  currentApplication = Application.currentApplication();
  currentApplication.includeStandardAdditions = true;
  const records = app.selectedRecords();
  records.filter(r => r.type() === 'group').forEach(r => {
    /* handle all groups */
   const plist = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  const chosenFile = currentApplication.chooseFileName(
    {withPrompt: `Select file to save URL for ${} to`, 
	  defaultName: `${}.inetloc`});
  if (chosenFile && /\.inetloc$/.test(chosenFile)) {
    const plistFile = currentApplication.openForAccess(chosenFile,{writePermission: true});
	currentApplication.write(plist, {to: plistFile, as: 'text'});

That will loop over all selected groups (ignoring other selected documents) and ask for a file name to save the plist to for each of them. This is not AppleScript but JavaScript code.

1 Like

May I ask why?

See our newest tutorial – Understanding Indexing – under Help > Tutorials. This also points you to the In & Out > Importing & Indexing section of the Help and manual.

When I am working on a project in a folder in the Finder, I’d like a quick link to the relevant group in DT. I can’t really use indexing since I am using multiple machines (with the appropriate # of licenses) and they each have slight differences in the overall file structure.

There’s a product called Hookmark which helps create various links. It’s pretty good. I use it with Devonthink. It can create a “Hookmark file” that can do what you want and paste that into the finder folder. What it is, is a text file but it acts as a link so when you click on it you go to your DT database link.
In practice, go to the DT file or folder, invoke Hookmark, then use either the menu or short cut shift-cmd-H, then paste/cmd-v into your folder in the finder.

Actually I found a pretty easy workaround. I can paste the link into Stickies then copy (or drag and drop) the link right into where I want in a finder folder.

And that is easier than using the script, possibly with a keyboard shortcut?