Question
Trying to batch print to postscript and getting AppleScript Error!
Here is the script as copied from Script Editor:
-- make a variable for the print settings to use:
set thPrintSettings to "Publishers PDF standard"
global thPrintSettings
-- initially, we'll allow for picking destinations at script start
set targetFolder to choose folder with prompt "Location for PDF files..."
global targetFolder
set varBasename to "CTB"
tell application "Adobe InDesign CS3"
-- Environment test: We want 1 book, no documents open:
try
get document 1
display dialog "Please run this script without any documents open (except one Book)" buttons "OK" default button 1
return
on error
-- we must be good to go, no documents open
end try
try
set thBook to book 1
on error
display dialog "Please open an InDesign Book to use this script" buttons "OK" default button 1
end try
if modified of thBook then
display dialog "This Book has been modified. Do you want to continue running the script?" buttons {"Cancel", "Yes"} default button 1
end if
tell thBook
set countOfThBook to (count of book contents)
set thContentsList to (full name of book contents) as list
end tell
-- return {countOfThBook, thContentsList}
set user interaction level of script preferences to never interact -- avoid any dialogs (for printing or saving)
set n to 0
repeat with j from 1 to countOfThBook -- loop through book's documents
set thDoc to item j of thContentsList
open thDoc
tell active document
repeat with c from 1 to (count of every ink)
tell ink c
set convert to process to true
end tell
end repeat
set myName to varBasename
repeat with i from 1 to count of pages -- loop through book's pages
set y to name of page i
set n to n + 1
tell print preferences
set page range to y --page range sets which page(s) to print
set active printer preset to thPrintSettings
set print file to alias ("" & targetFolder & myName & "_" & n & ".ps")
end tell
print --without print dialog
end repeat
close saving no
end tell
end repeat
end tell
Every time I try to run it I get the following error:
AppleScript Error
Adobe InDesign CS3 got an error: Invalid parameter.
Help!!!
-- make a variable for the print settings to use:
set thPrintSettings to "Publishers PDF standard"
global thPrintSettings
-- initially, we'll allow for picking destinations at script start
set targetFolder to choose folder with prompt "Location for PDF files..."
global targetFolder
set varBasename to "CTB"
tell application "Adobe InDesign CS3"
-- Environment test: We want 1 book, no documents open:
try
get document 1
display dialog "Please run this script without any documents open (except one Book)" buttons "OK" default button 1
return
on error
-- we must be good to go, no documents open
end try
try
set thBook to book 1
on error
display dialog "Please open an InDesign Book to use this script" buttons "OK" default button 1
end try
if modified of thBook then
display dialog "This Book has been modified. Do you want to continue running the script?" buttons {"Cancel", "Yes"} default button 1
end if
tell thBook
set countOfThBook to (count of book contents)
set thContentsList to (full name of book contents) as list
end tell
-- return {countOfThBook, thContentsList}
set user interaction level of script preferences to never interact -- avoid any dialogs (for printing or saving)
set n to 0
repeat with j from 1 to countOfThBook -- loop through book's documents
set thDoc to item j of thContentsList
open thDoc
tell active document
repeat with c from 1 to (count of every ink)
tell ink c
set convert to process to true
end tell
end repeat
set myName to varBasename
repeat with i from 1 to count of pages -- loop through book's pages
set y to name of page i
set n to n + 1
tell print preferences
set page range to y --page range sets which page(s) to print
set active printer preset to thPrintSettings
set print file to alias ("" & targetFolder & myName & "_" & n & ".ps")
end tell
print --without print dialog
end repeat
close saving no
end tell
end repeat
end tell
Every time I try to run it I get the following error:
AppleScript Error
Adobe InDesign CS3 got an error: Invalid parameter.
Help!!!
