Here is an automator workflow that does something similar so I believe you can adapt to your needs. This workflow is setup as a service workflow. It will combine PDFs in the order in which they are selected/clicked via the Shift key. The default name of the combined output file will be the name of the first file clicked. Automator can be activated by CTRL clicking any of the selected PDFs.
1. Service receives PDF files in Finder
2. Automator Action: Run AppleScript
on run {input, parameters}
display dialog "Files will be combined in the order selected via the Shift key" as text
return input
endrun
3.. Automator Action: Trim input items
keep the first one
you will need to download and install this autotmator action from here:
http://www.menace-enterprises.com/Files/Automator/Actions/Trim%20Input%20Items.d mg
4. Automator Action: Run AppleScript
(* Note & Definitions
This Applescript extracts the basename of the first selected file without its .pdf extension
"path_basename_ext" is full path and name, e.g. User/desktop/file.pdf
"NmExt" is filename with extension, e.g. file.pdf
"baseName" is the base filename without extension, e.g. file
"Ext" is the file's extension, e.g. pdf
*)
on run {input, parameters}
set path_basename_ext to input
tell (info for path_basename_ext) to set {NmExt, Ext} to {name, name extension}
set baseName to text 1 thru ((get offset of "." & Ext in NmExt) - 1) of NmExt
baseName
return baseName
end run
5. Automator Action: Set Value of Variable
define baseName as the variable
6. Automator Action: Get selected finder items
Options: check ignore input
7. Automator Action: Combine PDF pages
choose Combine by appending
8. Automator Action: Move Finder Items
choose To: Desktop
Options: check show this action when workflow runs
9. Name Single Items
choose Basename only to: baseName
Options: check show this action when workflow runs
10. Open Finder Items