Feature Request: Improved Merge

Relatively new to DTPO and liking what I see so far. As I assemble my database from the varied files across my computer, I’m often merging pdf documents. While I could do what I want in Adobe Acrobat, this adds some steps in itself and I’d prefer to do the simple merges within DT - hopefully with fewer steps.

As of now the multi-step process is 1) select docs to merge, 2) merge, 3) rename merged doc, 4) decide what to do with non-merged docs (has always been delete for me so far, so they all have to be selected again), 5) reorder pages within merged doc (if needed).

Some thoughts:
a) Allow drag and drop documents (pdf only of course), creating a merged doc retaining the same name as the doc dropped onto (and allowing an option to automatically delete the dropped file - could be case-by-case option or set to Always in Preferences).

b) Or if a) is too complex, after selection of the multiple documents, have the Merge command open a dialog box to determine the outcome - could be some check-boxes to pick final name from selected doc names, or enter new name; and other check boxes to decide what to do with original docs…

It is already possible to do everything you write about using the sidebar of the PDF display in DEVONthink. Copy pages or drag pages or whole PDFs from one PDF to another. Move pages around. Delete or copy pages. No need to use merge. Make the PDF sidebar visible and use it for your actions.

korm brings up a good point. Relating to your specific request about the mechanism, here’s my offering. Put it in ~/Library/Application Support/DEVONthink Pro 2/Scripts/Toolbar and restart DEVONthink and you can invoke if with a Toolbar button.

Note that the final file will still be the active selection, so a quick tap on the Return key will still allow for quick renaming of the file, if desired.

NOTE: Modified file is reposted below.

Comments about merging items:

Some like to merge collections of documents such as receipts, perhaps creating “books” of merged receipts by vendor or by date.

IMHO that reduces the ability to search and sort the individual receipts in ways that I might find useful. I prefer to keep receipts as individual documents. They can be grouped in any way that I might find useful, including smart groups.

I made a small adjustment to the script. Now if you don’t preselect an existing filename from the list of source document names, you will be presented with a dialog to enter your own.
DT_Merge and Delete.scpt.zip (3.16 KB)

I have just got around to trying out the Merge and delete script. I like it, though if I am processing large number of files, there is a modification that would, in my view, improve it.

One is that when the dialog to choose the filename appears, it would be good if the first filename could be selected already, so that it is enough to hit return, and not have to move to the mouse to select it (maybe there is a keystroke to avoid using the mouse, but either way it is an extra operation). I know that would remove the option to specify a filename, but it seems to make more sense as the default if the goal is being able to work quickly through a long list of files, merging ones that need to me merged, something I regularly do.

My preference would be to have two scripts, one where just hitting return gives the option to provide a new name, and one where it automatically uses the first filename (without even having to hit return) or “filename+n others”.

Is what I want the un-modified script, which I cannot find? Or did that not pre-select the first filename?

(Though using the filename of the first merged filename is OK, as it keeps the files in the correct sequence, I quite liked having “filename1 + n other files” as the default. It meant that glancing at a folder immediately told me whether I had processed that folder or not. But the solution is being careful about labelling folders when processed!)

No, and the unmodified script is not available.

No build preselected anything. I also question the usefulness of this since the “first file” is dependent on the current sort criteria.

May I explain why I would find this useful.

The reason is that I use DT to process photographs I have taken of archival materials, and I have a DT group corresponding to each physical folder in the archive, which may contain many documents, some single pages, others multiple pages. I convert to PDF using DT and then have to merge multipage documents into single files.

When I am merging files I always sort by filename, because that preserves the order in which I photographed the documents (they are filenames generated by the camera, such as IMG_4567). I may have a folder of a hundred pages, which I am working down, merging multipage documents into single files. And dozens of folders. Thus perfection would be being able to select a group of files, and then be able to press a single key to merge them into a new file, with a filename that retains the place in the alphabetical order (important), and to delete the merged files.

The script written for me in 2012 (which I modified to avoid having to choose the filename) almost did this. Select files, hit a function key, and because the merged files were already selected then press delete to move the merged files to trash. Two keystrokes, not one, but easy to do quickly. This script no longer works because DT has been changed so that after the operation, the merged files are no longer selected and have to be selected a second time (awkward when there are a lot of them and you have to remember which ones).

The new macro involves a minimum of three keystrokes (function key to run the macro, down arrow, return). I guess the requisite muscle memory will develop with practice, but at the moment I find hitting the down arrow key to select the first filename (the arrow keys are small on the Mac keyboard) and then Return awkward.

Having said this, I do appreciate the new macro which will get a lot of use. Than you for writing it.

You have a very atypical use case. Please start a Support Ticket and we can talk about your specific situation. Thanks. :smiley:

PS: If anyone is in a similar solution, I may post the results at a later time.

Here is a modified version of my script.

  • The script lists the titles of the selected documents and preselects the top document. A quick tap of the Return key uses this title. (Note: The current sort order determines this list’s order.)
  • Pressing Command-. i[/i] clicks the Custom button and allows you to enter a custom name.
  • The number of merged documents is reported as at the end of the merged document’s title.
  • The Spotlight Comments for the merged document lists the type and title of the merged documents. For example, My Research Notes

DT_Merge and Delete RO.scpt.zip (2.06 KB)

Thank you. It works nicely.

Roger

No problem.

Very nice script, two questions:

  1. Do the documents to be merged have to be PDFs?
  2. If not are there any kinds of documents that must not be included in the mix? A specific example might be an HTML
  1. No.

  2. Non-matching fileTypes will merge into a n RTF file. Bookmarks and Groups won’t work.

Thank you Jim.

My pleasure. I hope it’s useful.

Hi Jim

Is it possible to modify this script, that the filename does’nt contains “”?

Best regards
Michael

Here you go…
DT_Merge and Delete SN RO.scpt.zip (2.01 KB)

Thank you very much!

My pleasure. Happy merging! :smiley: