Relations of pasted Attachments

Hi again,

Another problem I hope to solve :slight_smile:

Part of my daily routine is being in consulting calls where I quickly need to make notes and attach screenshots. I did already a configuration that they are put into a _resources sup folder.

The problem now is when I want to archive/ move/ delete this note. The attachments now stay in this folder. And if I have multiple notes with attachments, I have no way to know which attachment is related to which note.

I tried already with a Smart Rule, which renames the attachment to give at least the same prefix as the note (which is based on date). But then when I paste the image into the Markdown document, it gets renamed, and the link stays with the original name.

Is there a way to solve that all but without to much auf manual work?

Thanks in advance, Bastian

Do you mean a folder in the Finder or a group in DT? The difference matters because

  • folder is a real “thing” in the file system and would hint at indexing in DT
  • group is a logical grouping of documents without an equivalent in the file system and would hint at importing

What does “archiving” imply? And what format is that not in – PDF? RTF? formatted note, aka HTML? Markdown? Which also implies the question how you attach your images to the note.

Ah, I see. You mention Markdown later.

You don’t. That is a misconception. You paste a reference to the image into your MD document. Just like a link in HTML.

A smart rule triggered on move/delete combined with a script comes to mind. Don’t know about “archive”, though. The main question is: What do you want to happen? You don’t say, AFAICT.
When you move an MD document – what should happen with the images it references?
When you delete an MD document – what should happen with the images it references?
When you “archive” an MD document – what should happen with the images it referenes?

If you can describe the desired process, a script should be able to handle it.

Oh, and there is the “Outgoing links” list in the document inspector (right sidebar). That show you all outgoing links in your MD file, including images.

2 Likes

Sorry it’s a Group, no Folder:

Yes, sorry mentioned it later. I wan’t everthing as Plain as possible where every app can read it, and I’m able to change it. PDF is maybe in some cases a soltion, thank you for the idea, but sadly not general. Archive for my, sorry here, is to moved it to a destination group where stuff is placed, I not longer need. So no function in DT.

Yes, this is what happens, true. But from the user perspective, I paste an image to the note. Another solution for my problem would be if the images were put as base64 into the file. Just the editor should then, when not in preview mode, shorten the Base64 code so that you still can edit comfortably. That would lead to bigger files, but at least when I move it, all the content stays in.

Evernote does something like that, which simplifies the process of moving notes.

So archive equals move, so basically when I move, the images need to follow; when I delete, the images need to be deleted.

Nice, this is something I could work with. I just don’t have the energy to learn AppleScript. When it comes to complex stuff, AppleScript looks terrible to read. Plan B: The JavaScript, but I’m unable to find any documentation or resources for it. I already supercharged OmniFocus thanks to the developer documentation; that’s something I miss with DT. (Plan A would be Python anyway, but that will stay a dream. :slight_smile: )

Not a good idea. Such a file will be huge, and the editor will not shorten anything. At least not DT’s editor.

Follow where? I know that I sound pedantic, but it’s impossible to provide a script if the requirements are not clear.
So, you move an MD file to

  • in a database, outside any group?
  • inside a group?
    And the images are supposed to go
  • in the database, in the same group as the MD?
  • in the database, but always in a fixed group like _resources
    ?

As usual, DT’s scripting model is available in Script Editor (switch the language selector to JS). And then there’s Scripting with JXA | JavaScript for Automation (JXA) for more general information on JS scripting.

Yes, as a developer, that’s clear to me :slight_smile: Sorry

That should work always:

When moving the markdown file to another group in the same or a different database, the images are supposed to follow into the _ressources subgroup next to the markdown file.

That is a perfect site, thank you. There is even a DEVONthink section. With that, I have to spend some time next weekend :slight_smile:

Yes, the file would maybe be big, but at the end, the preview has the same amount of data to load; it doesn’t matter if the file is internal or external. Just that base64 makes it a bit bigger, that is true. And yes, as mentioned, the editor would need to support that; otherwise it would be impossible to edit. Maybe with the existing preview function for Markdown images, that can be solved (in the settings for Markdown). Obsidian has a plugin for that. But I guess in DT I cannot hook a script in between paste and safe.

I haven’t internalised the full thread. Apologies. But as you have text and images in the same document, use a DEVONthink file format that is designed for that, e.g. Rich Text.

Or, use Microsoft Word, Apple’s Pages, or any of the other plethora of apps built for text+images.

Then, if you really need a Markdown file, “convert” to that and then deal with all this complexity you are creating and worrying about by exception.

Keep it simple.

This all based on my hunch of the root cause of this issue. Could be wrong, of course.

1 Like

The thought is interesting, and I do this in some cases for temporary data. For example, I use Omnioutliner.

But the use case here is my “Knowledge base.” I need to write and format in a quick way, which makes Markdown perfect. Also, I need a way to link notes. Which is also easy with Wiki Links.

And the main reason I don’t want to bind myself any more to a program/ format. My way over the last 10 years was to switch:

Evernote → Devonthink 3 → Evernote → Obsidian → Evernote → Joplin → Devonthink 4

It was always easy to get out of Evernote. But Joplin was a pain. Everything I do now in DEVONthink for my knowledge base, is in a format that works out of the box with other apps. So I tested how I can format Markdown files with Custom Attributes and Tags, including link, in a way that they also would work, for example in Obsidian when I pull the Group into the Finder.

I’m absolute happy with the result. But the only pain point are the pasted images to the note, when I capture for example in the Inbox and then want to move the note to the final Group.

Did not have the time the last weeks, but will look into building a Smart Rule which uses the help of a Script to identify all the linked images to the MD document, and makes them move too with the document. And when possible, as a bonus, I will rename the images so that they will have a reference in the filename as well.

A Alternative would be to have a Group for every Document, but I’m not sure how to feel about all the groups. With a Smart Group, I could list all the (MD) Documents again to have them in a simple view while in the background all attachments would be in the documents group.

Thanks for the explanation. The issue is that what you expect and want to do with Markdown conflicts with what Markdown designed to do.

2 Likes

You may want to take a look at this thread…

1 Like