Add Pages to Item via ScanSnap

I’m coming to DevonThink from Paperless, where it’s trivial to add pages to previously-imported or scanned items by scanning them. In Paperless, one right-clicks the item in the database and chooses “add from scanner.” Once the additional pages are scanned, they are amended to the end of the existing item, which retains all its metadata.

The only way I’ve found to accomplish this in DevonThink is to scan the new pages, then select them and the existing item and merge them. Doing this causes the newly-created merged item to lose all of the metadata from the previously-existing item. Then the metadata has to be re-entered for the merge item and the Date Added is reset. This seems very inefficient, time-consuming, and error-prone.

Please tell me there’s a better way I’m missing.

It loses what metadata in DEVONthink? Please be clear and specific about these kinds of details.

Also, you don’t have to merge the documents (though I saw no loss of tags when I did, hence my request for clarification). You can show the Tools > Inspectors > Content: Thumbnails inspector for a PDF, then drag and drop another PDF into its thumbnails.

PS: DEVONthink isn’t Paperless, nor it/was it a direct competitor to it. Paperless was a bespoke application, created for a specific purpose, and developed according to the features needed or requested by its clientele.

Thank you! It’s the custom metadata that gets reset at merge.

Here’s the state of the custom metadata of an item prior to adding another page via Merge:

And here’s the post-merge item’s custom metadata:

I hadn’t discovered the Thumbnails Inspector since I “live” in the Custom metadata. It’s a good backup plan since it’s less work than manually re-entering custom metadata whenever I need to add a new page to an existing item.

I know DevonThink is not Paperless. My intention is not to criticize a product for not being a different product. As a newcomer to DevonThink, I’m just here to ask if I’ve missed something and, if not, maybe suggest something that could make DevonThink significantly easier and more efficient (read: more Mac-like) for everyone.

No worries, thanks for the clarification, and I intended no offense either :slight_smile:

What you describes happens when you use the Merge 2 documents from the popup menu (at least with PDF documents, which I assume you were talking about). When you drag & drop the new document to the end of the old one, the metadata remains intact.

I suppose that’s because “merging” does not imply a hierarchy. So, the (empty) custom metadata from the new document probably overwrites the existing one. Which seems as (un)reasonable as having the old metadata overwrite the (empty) new one.

Long story short: Dragging and dropping the new page(s) onto the old document is a workaround. Not a pretty one, though. But I have no idea how a merge would reasonably handle merging the metadata of two documents. Imagine that they have overlapping data?

I think it’s quite elegant and useful.

I suppose that’s because “merging” does not imply a hierarchy.

As noted in the documentation, merging is always top-down.

OK, that is relevant for the page order. But it doesn’t explain anything about the handling of custom meta data fields. And using the mouse to merge documents is … well – feasible. Just not something that could be automated. Unless I’m overlooking something.

Tags are preserved; other metadata (ratings, lables, custom metadata) are not. Development would have to assess if this.

Merging tags is no problem but merging e.g. inconsistent labels, ratings or custom metadata is difficult. But a script could merge the items and simply retain the metadata of the first item.

1 Like

I would have offered a simple JavaScript script, but the merge command does not work yet with merge – somehow, the records parameter is always passed as an empty array. So, an outline of the code instead

  • sort the selected records by creation date into a list of records
  • save the custom metadata from the first element of this list in customMD
  • call merge with this list to create a newRecord
  • set the custom metadata of newRecord to customMD

That can be written in AppleScript, though the sorting part is no fun. If there are always only two records to be merged, it’s probably easier to look at their creation dates separately and just swap them if needed.

I don’t know if this is broadly useful but…

-- Merge and Keep Metadata
-- Created by BLUEFROG/Jim Neumann on Sun Jul 07 2024
-- Copyright 2024 DEVONtechnologies, LLC. All rights reserved.

(* Merges selected documents, preserving the name and custom metadata of the topmost document in the selection. Optionally moves the original documents to the database's Trash.*)

property removeOriginals : true

tell application id "DNtp"
	if ((count (selected records)) ≤ 1) then return
	set sel to (selected records) -- The Sort method matters in this merge as well.
	set topDoc to (item 1 of sel)
	set mergeDoc to merge records sel in current group
	set properties of mergeDoc to {name:(topDoc's name), custom meta data:(topDoc's custom meta data)}
	if removeOriginals then move record (every item of sel) to trash group of current database
end tell
1 Like

This script works like a charm! I added the script to the Contextual Menu folder and now I can use it by right-clicking on the selected items in the View pane. Thank you.

1 Like

You’re welcome and I’m glad it is useful to you :slight_smile: