Script to drag and drop files onto an open dialog box in Acrobat

Hi all,

I’m having to work on a few hundred files, making pdfs then combining two at a time to make a new, single, pdf. I’m using Acrobat Professional for this and have the following script already:

on run {input, parameters}
	
	try
	tell application "Finder" to set theName to name of item 1 of (get selection)
	set the clipboard to theName
end try
tell application "Adobe Acrobat Pro"
	activate
end tell

tell application "System Events"
	tell process "Acrobat"
		tell menu bar 1
			tell menu bar item "File"
				tell menu "File"
					tell menu item "Combine"
						tell menu "Combine"
							click menu item "Merge Files into a Single PDF..."
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell
	
	return input
end run

I select the first PDF, run the script using Automator (from a contextual menu), then wait for the Combine PDFs dialog box to open, and select the second pdf, then drag and drop both files into this dialog box.

Can I amend this script so that any selected files are automatically dragged from the finder into the Acrobat dialog box?

Any help much appreciated.

Osmo

Rather than trying to drag files onto an open dialog box it might be easier to get Acrobat to do it. I have done this fairly recently to create pdfs with several hundred pages from separate ones.

Here’s a bit of a start with scripting Acrobat to do it.:-

insert pages document activeDoc after thisPage from document thisName starting with 1 number of pages 1

It’s just a question of looping through the pdfs and opening the two that need to be combined.

Nick

P.S. If you’re feeling a little adventurous there’s also Acrobat Javascript, have a look through the Acrobat Javascript Reference:-

this.insertPages ({
nPage: (this.numPages - 1), // was -1
cPath: “/This HD/Path/to/files/”, nStart: 0
});

Many thanks, Nick, for helping with this. Unfortunately, my scripting skills are very amateurish and I can’t get your scriplet to work with mine, nor on its own: it won’t compile. Do I need to modify it somehow?

Can anyone help me with this? I’m completely stuck. Automator’s combine pdfs function corrupts the fonts in my pdfs so I have to use Acrobat’s combine feature.

How do I get Nick’s script incorporated into mine?

Thanks

Hi Osmosis, a quick couple of questions.

When you create the pdfs are they sequentially numbered or something like that?
How do you know which two pdfs go together?

Thanks,
Nick

They’re sequential in terms of name, but not number. I choose the two PDFs that go together from a folder in the Finder. Basically, think of two Photoshop files that are in a folder. PDFs are made from these so the folder now has four files in it. Two PSDs, two PDFs. I select just the PDFs and drag them into Acrobat.

I then do this for the other PDFs in a bunch of other folders.

Cheers