PDA

View Full Version : Applescript to interleave pages in Preps


jcarlson
05-10-2007, 05:07 PM
Hello All,

I am trying to create an Applescript in Preps to interleave pages and haven't had any luck. Hopefully someone here can help me out.

For example, say I have a 1000 page pdf, I would like to add another one page pdf in between each of the 1000 pages in the run list. What I'm trying to accomplish is very similar to the "interleave blank pages" script that already exists in Preps. I tried altering that script to add a one page pdf instead of a blank page but I couldn't get it to work. Any help would be appriciated!

Thanks, Josh

paul.abney
05-14-2007, 02:33 PM
Josh,

Maybe this will help.






display dialog "Is the common page the first page or last page of a single file or a single page in a new file?" buttons {"First Page", "Last Page", "Seperate Page"} default button 3
set the button_pressed to the button returned of the result
if the button_pressed is "Last Page" then
display dialog "This script interleaves the last page of the file with the rest of the file The last page of the file must be the common page." buttons {"OK", "Cancel"} default button 1
if the button returned of the result is "OK" then
tell application "Preps 5"
if exists the front job then
set numpages to ((pagecount of jobfile 1) - 1)
repeat with n from 1 to numpages
insert page n of jobfile 1 at end of runlist
insert last page of jobfile 1 at end of runlist
end repeat
end if
end tell
end if
else if the button_pressed is "First Page" then
display dialog "This script interleaves the first page of the file with the rest of the file The first page of the file must be the common page." buttons {"OK", "Cancel"} default button 1
if the button returned of the result is "OK" then
tell application "Preps 5"
if exists the front job then
set numpages to (pagecount of jobfile 1)
repeat with n from 2 to numpages
insert page n of jobfile 1 at end of runlist
insert first page of jobfile 1 at end of runlist
end repeat
end if
end tell
end if
else
display dialog "This script interleaves one file with the another file. The first file must contain the changing pages and the second file must be the common page." buttons {"OK", "Cancel"} default button 1
if the button returned of the result is "OK" then

tell application "Preps 5"
if exists the front job then
set numpages to pagecount of jobfile 1
repeat with n from 1 to numpages
insert page n of jobfile 1 at end of runlist
insert page 1 of jobfile 2 at end of runlist
end repeat
end if
end tell
end if
end if




Let me know if you need clarification on anything.


Paul Abney
EMPrintiing

jcarlson
05-15-2007, 02:49 AM
Thank you so much Paul. This is exactly what I was looking for!