Hi all,
Ok, to begin with, I regularly get proof PDFs from a printer that look like this: http://www.veloce.co.uk/newsletter/rippedpdfexample.png
As the red lines in the example show, I want to crop them one by one and print each section (in this case, 8 sections).
To do this, I’ve created a very crude applescript that selects the folder of PDFs (all the same size) and then runs through a series of pre-prepared cropping instructions in Acrobat 7 Professional (using lots of tabbing!), chopping up the PDF one section at a time and printing it. The numbers in the script are entered into the relevant crop boxes, ie Top, Bottom, Right or Left. The script is on a Repeat, so it closes the PDF and opens the next one in the folder. It works fine, although on random occasions fails to enter the details and subsequently ruins the whole sequence.
Does anyone of a way of not having to use the GUI and all that horrendous tabbing? Currently it means I can’t use my computer while the script is running as Acrobat has to be on top. So far I’ve failed in instructing Acrobat to crop any other way “ I had hoped using Crop Box as a reference would have worked but so far, no luck.
Many thanks “ here’s the script (you will see it’s separated up into the 8 pages):
set folder_to_print to choose folder with prompt "Choose the folder of PDFs to crop and print."
set item_list to list folder folder_to_print without invisibles
tell application "Printer Setup Utility" to set a to name of printers
set b to (choose from list a) as text
tell application "Printer Setup Utility" to set current printer to printer b
repeat with print_item in item_list
set the_alias to alias ((folder_to_print as string) & (print_item))
tell application "Adobe Acrobat 7.0 Professional"
activate
open the_alias
-- page 1 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 5 times
keystroke tab
end repeat
keystroke "606"
repeat 2 times
keystroke tab
end repeat
keystroke "289"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 2 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 5 times
keystroke tab
end repeat
keystroke "406"
repeat 17 times
keystroke tab
end repeat
keystroke "205"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 3 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 5 times
keystroke tab
end repeat
keystroke "204"
repeat 17 times
keystroke tab
end repeat
keystroke "406"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 4 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 5 times
keystroke tab
end repeat
keystroke "0"
repeat 17 times
keystroke tab
end repeat
keystroke "607"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 5 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 7 times
keystroke tab
end repeat
keystroke "0"
repeat 17 times
keystroke tab
end repeat
keystroke "288"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 6 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 4 times
keystroke tab
end repeat
keystroke "406"
keystroke tab
keystroke "204"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 7 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 4 times
keystroke tab
end repeat
keystroke "205"
keystroke tab
keystroke "406"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
end tell
-- page 8 --
tell application "System Events"
keystroke "T" using command down & shift down
delay 8
repeat 4 times
keystroke tab
end repeat
keystroke "0"
keystroke tab
keystroke "606"
keystroke return
delay 8
end tell
tell application "Adobe Acrobat 7.0 Professional"
print pages active doc PS Level 3 with shrink to fit
delay 8
close front document saving no
end tell
end tell
end repeat
display dialog "Finished" giving up after 3
Browser: Safari 531.9
Operating System: Mac OS X (10.6)