1 Reply Latest reply: Feb 10, 2013 2:43 AM by twtwtw
Elosan Level 1 Level 1 (0 points)

Ok, here is the situation, I have alot of photographs in seperate folders that I would like to make them into pdf files.  I am looking for a way to use Apple Script or Automator (or both) to create pdf files out of jpg images, combine them into one pdf file, and then have the pdf file rename based off of the folder in witch the orginial photographs were in.  Bascially it is like this...


I would like to take these folders


Folder: Family Summer Vacation

                    Folder Contents:  image 001.jpg, image 002.jpg, etc...

Folder: Family Chrstmas

                    Folder Contents: Christmas 1.jpg, Chirstmas 2.jpg, etc...

(there are many more folders)


Results afterwords..


Family Sumer Vacation.pdf

Family Christmas.pdf


Now the thing is that I do not want to do these one at a time.  Is there a way I can use automator or Applescript to select several folders at once to make the pdf files?


I have tried to look online for solutions but most of the answeres only went half way...

To create mutiple PDF files, did come across a program for automotar that did this....

-Get Selected Finder Items

-Dispense Items Incrementally

-Set Value of Variable (Storage)

-Get Folder Contents

-New PDF From Images



This works merging the JPG files into a single PDF file.  However, the problem is that it does not name pdfs file off of the folders from which they came.  I apperciate the help :-)

MacBook Pro (15-inch Late 2011), Mac OS X (10.7.5)
  • twtwtw Level 5 Level 5 (4,900 points)

    It's a bit of a trick, but the way I'd do this is to call an automator workflow inside an applescript loop.  First you set up a workflow that looks like this (save it somewhere convenient):



    Note carefully the two variables - NewName and FolderPath - and how they are used in the various actions.  FolderPath is a path variable, NewName a text variable, and it's important that they get set up correctly, because that's how we get info into the workflow.


    Once that's made and saved, copy the path to the workflow into the first line of the following script, run it in the applescript editor, and you should be good to go. (one note - it won't overwrite pdf files of the same name, so you might end up with duplicate files - filename 2. pdf, filename 3.pdf - if you run it on the same folder(s) a few times).


    set workflow_path to "'/path/to/workflow.workflow'"


    choose folder with multiple selections allowed

    set the folder_list to the result


    repeat with this_folder in the folder_list


      -- get name and posix path of a folder

              tell application "System Events"

                        set the folder_name to the name of this_folder

                        set the folder_path to POSIX path of this_folder

              end tell


      -- call automator workflow to process pdfs

              do shell script "automator -D NewName=" & quoted form of folder_name & " -D FolderPath=" & quoted form of folder_path & " " & workflow_path


    end repeat