--Last Updated: October 9, 2010 (* NOTE: THIS IS CONFIGURED FOR MY OWN MACHINE WITHOUT SETTING UP THE FOLDERS, CREATING PHOTOSHOP ACTIONS TO PROCESS THE IMAGES, AND CREATING THE AUTOMATOR WORKFLOW TO MERGE THE IMAGES THIS WILL NOT WORK ON YOUR COMPUTER THERE ARE ALSO A FEW HARD CODED ADDRESSES WITHIN THE SCRIPT I HAVEN'T ADDED TO THE CONFIGURATION SECTION THAT NEEED TO BE MODIFIED *) --CONFIGURATION: --The source folder with the images to be processed and converted to PDFs: set sourceFolder to "/Users/fool/Desktop/MassConvert/" --The folder that the automator workflow will work on set convertFold to "/Users/fool/Documents/MassConvert/MassConvert/" --The location of the Automator workflow that merges the images into a PDF: set workflowPath to "/Users/fool/Documents/Docs/Scripts/MassConvert.workflow" --This work flow gets all the files in the converted folder and creates a new PDF out them. Haven't had good results doing this within the script or via shell script. --NOTE: if there are ' marks in the file name tell application "Finder" set folderFile to ((POSIX file sourceFolder) as string) --Only execute remainder of script if there is at least one folder of images in the source if (count folder of folder folderFile) is greater than 0 then --get all the folders set folderList to every folder of folder folderFile --perform the following on all the images in each folder: repeat with imageFolder in folderList --find out how many files, roughly, are being copied so we now roughly how long to wait for the copying to complete set imageNumber to (do shell script "ls -l " & sourceFolder & (quoted form of (name of imageFolder as string)) & " | egrep -c '^-'") do shell script "cp " & (the quoted form of (sourceFolder & (name of imageFolder as string) & "/")) & "* " & ¬ (the quoted form of convertFold) --wait about 1 second per 8 images: delay (round (2 + (imageNumber / 8))) --the PrepMassConvert action runs the "PrepPDF" action on each file in the target folder --the PrepPDF action in Photoshop increases brightness and contrast, reduces the image size tell application "Adobe Photoshop CS3" with timeout of 1600 seconds do action "PrepMassConvert" from "Default Actions" end timeout end tell --Now run the workflow: do shell script "automator " & (the quoted form of workflowPath) --Clean up the two conversion folders and delete their contents: do shell script "rm -R /Users/fool/Documents/MassConvert/MassConvert/*" do shell script "rm -R /Users/fool/Documents/MassConvert/MassConverted/*" --change the "converted.pdf" file into the name of the folder it came from, which ought to be the title of the book set theFile to POSIX file "/Users/fool/Desktop/converted.pdf" delay 0.5 set the name of file theFile to ((name of imageFolder as string) & ".pdf") end repeat end if end tell