I have this script that I like but is has some flaws. It doesn’t create the PDFs in the “done_folder” and doesn’t move the source files to the “originals_foldername” when it’s done.
On a wish list I’d prefer use this a folder action too… so when I drag files to the folder it creates the PDF. Then have it create a JPEG from the PDF using another folderaction script applied to the “done_folder”. By doing this system I can have it “assembly line” produce the files I need.
--http://bbs.applescript.net/viewtopic.php?p=31433
property done_folder : "PDFs"
property originals_foldername : "Completed Files"
--on open theFiles
on open sourceFolders
repeat with sourceFolder in sourceFolders
--set sourceFolder to fullname of theFiles as Unicode text
--repeat with aFile in sourceFolders
tell application "Finder"
try
-- If you would like to include subfolders, you say - every file of entire contents of folder
set idFiles to (every file of folder sourceFolder whose file type is "IDd3") as alias list
on error -- work around bug if there is only one file
set idFiles to (every file of folder sourceFolder whose file type is "IDd3") as alias as list
end try
end tell
tell application "Finder"
if not (exists folder done_folder of sourceFolder) then
make new folder at sourceFolder with properties {name:done_folder}
end if
set the results_folder to (folder done_folder of sourceFolder) as alias
if not (exists folder originals_foldername of sourceFolder) then
make new folder at sourceFolder with properties {name:originals_foldername}
set current view of container window of sourceFolder to list view
end if
set the originals_folder to folder originals_foldername of sourceFolder
end tell
if idFiles is not {} then
tell application "InDesign CS"
set user interaction level to never interact
repeat with i from 1 to count of idFiles
open item i of idFiles
tell document 1
--LABEL FILES
set docName to full name as Unicode text -- name includes .indd should remove at some point
set clipPoint to offset of ".indd" in docName
set trimmedName to (characters 1 thru (clipPoint - 1) of docName) as string
--ACTIONS
with timeout of 1800 seconds -- 30 minutes
export format PDF type to trimmedName & "_press" & ".pdf" using "KMC_Press_1" without showing options
end timeout
close without saving
end tell
end repeat
set user interaction level to interact with all
end tell
end if
return 10 -- try again in 10 seconds
end repeat
end open