Hi,
I used to use the batch print function in Adobe Acrobat Pro to print a folder full of pdfs. When I did this, the items in the folder would not print in order. That is if I had Item A, Item B, Item C, Item D… the order of printing might be Item B, Item D, Item C, Item A.
I wrote an applescript so that pdfs would print in alphanumerical order. Here it is:
property FileTypeList : {"PDF"}
property extension_list : {"pdf"}
global this_info
on run
display dialog "Don't doubleclick me! Drop a folder on top of me to execute program!" buttons {"OK"}
end run
on open these_items
with timeout of 600 seconds
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items) as alias
set this_info to info for this_item
if folder of the this_info is true then
process_folder(this_item)
else
try
set this_extension to the name extension of this_info
on error
set this_extension to ""
end try
try
set this_filetype to the file type of this_info
on error
set this_filetype to ""
end try
if (folder of the this_info is false) and (alias of the this_info is false) and ((this_filetype is in the FileTypeList) or (this_extension is in the extension_list)) then
process_item(this_item)
end if
end if
end repeat
end timeout
end open
on process_folder(this_folder)
set these_items to list folder this_folder without invisibles
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as Unicode text) & (item i of these_items))
set the this_info to info for this_item
if folder of the this_info is true then
process_folder(this_item)
else
try
set this_extension to the name extension of this_info
on error
set this_extension to ""
end try
try
set this_filetype to the file type of this_info
on error
set this_filetype to ""
end try
if (folder of the this_info is false) and (alias of the this_info is false) and ((this_filetype is in the FileTypeList) or (this_extension is in the extension_list)) then
process_item(this_item)
end if
end if
end repeat
end process_folder
on process_item(this_item)
tell application "Adobe Acrobat Pro"
activate
open this_item
print pages active doc PS Level 3
delay 0.5
close active doc
end tell
end process_item
For six months, it has worked as I wanted. PDFs would print in the order of ascendence as they appeared in the folder. Today, however, I printed a folder of about 90 pdfs, and they printed out of order. I thought that putting the items into a list, then using a repeat loop would force the items to print in order, but I must be wrong about that. Can anyone think of why this happened or how I might fix it?