Help with Merging jpgs in Multiple Folders?

Hello all,

I’ve been a long-time fan of DT, but this is my first time posting on the forums. I don’t have much experience with Automator or AppleScript functions, but recently have been trying to use them to simplify my work-flow. I have a bunch of Folders with pictures that I want to collate into PDFs. So for example, I have Folder A with 90 jpg pictures that I want to output into 1 PDF. So far I what I have been doing is manually merging all of the JPGs into 1 PDF and then deleting the JPGs from the folder, so I end up having one folder (Folder A) with one PDF (PDF A). Since I have more than 100 folders of pictures, it’s becoming tedious to do that for each folder. Does anybody know how I can automate the workflow with an Automator workflow or Applescript, or any other program? I’m also new to using Hazel, but I’m not sure if that would help.

Many thanks for any assistance you can give! Sorry if this post is convoluted.


Here’s a simple example. WARNING: You have to select one or more groups containing only mergable documents (e.g. only images) but not containing subgroups, smart groups, feeds, bookmarks etc.

tell application id "com.devon-technologies.thinkpro2"
	set theSelection to the selection
	repeat with theGroup in theSelection
		if type of theGroup is group then
			set theChildren to children of theGroup
			set theResult to merge records theChildren in theGroup
			if (exists theResult) and (theResult is not missing value) then
				set theTrash to trash group of database of theGroup
				repeat with theChild in theChildren
					move record theChild to theTrash
				end repeat
			end if
		end if
	end repeat
end tell

This is awesome! Thanks so much! DT Forums are the best.