Feature Request: Improved Merge

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.


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

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

Thank you very much!

My pleasure. Happy merging! :smiley:

Hi Jim,

I am not sure if this is the thread you gave me the link to, but this is actually what I was looking for. So thanks in any case!

One question: Is it possible to modify the merge + delete function so that the file is automatically named after the first file that was selected? Roger’s old script used to do this and it was much smoother.


I am curious Jim as to why you decided to make this available only as a ‘run only’ script. Does it use a private api for DT which the DT dictionary doesnt expose yet :wink: ? (Hinted at here)

… heads off on a hunt for an applescript decompiler :smiling_imp:


@Frederiko: Nope. All public APIs. It’s likely just force of habit. I have scripted professionally for almost 20 years, mostly in large corporate situations. Issuing RO versions was just part of the routine so I didn’t have people rooting around and breaking things (which would lead me to have to fix things I shouldn’t).

Old habits… :smiley: