Ok, I think I have the final working workflow.
I am using 2 workflows. The first one takes a multipage pdf document and extracts each page to a .jpg image. Both of these automator actions are saved as applications. The first action needs to have the pdf file drag and dropped onto it.
-Ask for Confirmation
“Drag a pdf file onto this Icon to save each page as an image.”
“You will have to choose a size and then you will be prompted for file name and location options.”
-Get Specified Finder Items
-Run Applescript - This is an error control.
tell application "Finder"
if input = {} then
display dialog "This only works if you drag a pdf onto it." with icon stop ¬
buttons "cancel"
else
return input
end if
end tell
-Render PDF Pages as Images
-Rename Finder Items (Make Finder Item Names Sequential) - renames files starting at “pg01.jpeg”
-Rename Finder Items (Replace Text in Finder Item Names) - replaces “.jpeg” with “.jpg” Finder automatically names the files with the extension “.jpeg”, but I need it to be “.jpg”.
-New Folder - Asks user to create a new folder where the images are placed.
The next workflow application works when the user drag and drops this folder full of images onto it.
-Run Applescript - Resets the clipboard -(erases the clipboard - Be careful)
tell application "Finder"
set clipboard to ""
end tell
return input
-Get Specified Finder Items
-Get Folder contents
-Run AppleScript - error control
tell application "Finder"
if input = {} then
display dialog "This only works if you drag and drop a folder on to it with sequentially named image files. For example img01.jpg img02.jpg etc." with icon stop ¬
buttons "Cancel"
end if
end tell
return input
-Copy to Clipboard
-Run AppleScript
set odd_List to {}
repeat with each_1 in input
set final_dig to character ((offset of "." in (each_1 as text)) - 1) of (each_1 as text)
if (final_dig mod 2) ≠0 then set end of odd_List to (each_1 as text)
end repeat
return odd_List
-At this point I perform actions on the odd numbered files using the photoshop actions from www.completedigitalphotography.com
-Get Clipboard Contents - This plugin comes from http://www.automatedworkflows.com
-Run AppleScript - This applescript takes the contents of the clipboard and turns it into a list of file paths for the next applescript.
set master_List to {}
--set textFile to input as string
set i to ""
repeat with i from 1 to (count of paragraphs in input)
set end of master_List to (paragraph i of input as alias)
end repeat
return master_List
-Run AppleScript
set even_List to {}
repeat with each_1 in input
set final_dig to character ((offset of "." in (each_1 as text)) - 1) of (each_1 as text)
if (final_dig mod 2) = 0 then set end of even_List to (each_1 as text)
end repeat
return even_List
-At this point I perform actions on the even numbered files using the photoshop actions from www.completedigitalphotography.com
-Get Clipboard Contents - This plugin comes from http://www.automatedworkflows.com
-Run AppleScript - This applescript takes the contents of the clipboard and turns it into a list of file paths for the next Photoshop actions. This list is once again both even and odd files.
-At this point photoshop actions are performed to create thumbnail images.
One problem with the first action is that If you run the application again to create another folder full of images from a pdf, it names the files starting with the last number from the last time you ran the action. In other words, if you ran the application on a 24 page pdf you would get a folder full of .jpg named “pg01.jpg” to “pg24.jpg” If you then run it on another 10 page pdf you will get .jpgs named “pg26.jpg” to “pg35.jpg”. Not “pg01.jpg” to “pg10.jpg”. The only way I’ve found around this is to sequentially name the files differently such as “page01.jpg”.
I’d like to thank Craig for his excellent applescript. I’ve tried getting this working for quite a while and couldn’t have made it work without his help.
-Jim
Model: MBP and PMG4 MDD
Browser: Camino 1.6.4
Operating System: Mac OS X (10.4)