Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use Automator for manipulating Scanned PDFs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Automator for manipulating Scanned PDFs
Authored by: robsilve on Jun 25, '10 10:29:52AM

For anyone who is interested, I wrote an applescript a while back that performs a similar function:
Paste everything below into the Script Editor:

-- This script is for those of us who have scanners with a document feeder, but the document feeder can only scan 1 side of a double sided page at a time. This script will set the names of scanned files to the correct order after scanning side one of a packet, then side two of a packet. Script by Bob Silverstein - silverst@orthonj.com. This is provided as donation-ware. If you find it useful, please donate what you think it is worth to my paypal account using the above email address.
(* Put the document packet to be scanned in the document feeder and scan it (first page on top). Remove the packet from the output bin and put it back into the document feeder with the last page on top. (You will now be scanning the last page first, and the first page of the document will be face down on the bottom of the pile. If the last page is blank or you don't want whatever is on the last page to be part of the document, remove this page from the top of the pile and don't scan it). After scanning is complete, move the files to be renumbered into an empty folder (nothing else is in that folder besides the files to be renumbered). Then open the window of this folder and make sure it is the front-most window. Make sure the list is sorted by name in ascending order. Then launch this script. The list of files can now be dragged and dropped onto Acrobat's icon (note that this is the application that can create PDFs, not the reader) and made into a single document in the correct page order. Note that if you want acrobat to combine all of the pages into a single document and the documents are all PDFs, this drag and drop method will not work; Acrobat will just open all of the documents rather than combining them. If you want acrobat to be able to combine them, set your scanner software to save the files as TIFFs or JPEGs.*)

property the_extension : ".tif"
--change the extension in quotes to the original extension of the scanned files (if your scanner software generates files with the .jpg extension, use .jpg above)
property the_filename : "file"
--the base filename can be whatever you want, as long as it is different from the original base filename of the scans (if your scanner software names the pages "page001", "page002", etc., don't set the base filename above to "page").
property num_scans : "1000"
--this is the maximum number of pages that you would scan per document. You can increase this if you need to scan more pages at once.
try
tell application "Finder"
set the source_folder to (folder of the front window) as alias
end tell
end try

set the item_list to list folder source_folder without invisibles
set source_folder to source_folder as string
set num_items to number of items in the item_list

--even number of files
if num_items / 2 mod 1 is 0 then
set first_half to (num_items / 2 as integer)
set second_half to first_half
else
--odd number of files
set first_half to (num_items / 2 div 1) + 1
set second_half to first_half - 1
end if

--first half
set increment to -1
repeat with i from 1 to first_half
set increment to increment + 1
set this_item to item i of the item_list
set this_item to (source_folder & this_item) as alias
set this_info to info for this_item
set the current_name to the name of this_info
set the text_item_list to every text item of the current_name
set the new_item_name to the_filename & (num_scans + i + increment) & the_extension
my set_item_name(this_item, new_item_name)
end repeat

--second half
set increment to 0
repeat with i from 1 to second_half
set increment to increment + 1
set this_item to item (num_items + 1 - i) of the item_list
set this_item to (source_folder & this_item) as alias
set this_info to info for this_item
set the current_name to the name of this_info
set the text_item_list to every text item of the current_name
set the new_item_name to the_filename & (num_scans + i + increment) & the_extension
my set_item_name(this_item, new_item_name)
end repeat

on set_item_name(this_item, new_item_name)
tell application "Finder"
activate
try
set the name of this_item to new_item_name
end try
end tell
end set_item_name



[ Reply to This | # ]