Merge all items in group

Hello,
I am trying to automate a selection of all the items (images) in a group, then do a merge of those items to PDF with “Merge” command.

I wrote an Automator workflow with this action sequence:

  1. Get selected records

  2. Get Group Contents (don’t repeat for each group found, exclude input group records)

  3. Run ActionScript


on run {input, parameters}
	
	tell application id "com.devon-technologies.thinkpro2"
		try
			
			
			set RecordsToMerge to (the records of input)
			
			
			merge records RecordsToMerge
			
		on error error_message number error_number
			if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
			
			
		end try
	end tell
	
end run

While the script runs without errors, I am not getting the result PDF.

Any help would be appreciated, since this is also my first attempt at writing a script, not only for DT, but in the Apple world :slight_smile:

You don’t need to use AppleScript at all but approach the problem from the PDF side. Export all pages and merge them using the PDF Automator actions, then import the result back into DT.