This is the script I’ve written so far, which doesn’t work:
property wn : ""
property wi : ""
property hn : ""
property hi : ""
property wdecs : ""
property hdecs : ""
property wdecsOne : ""
property wdecsTwo : ""
property wdecsThree : ""
property hdecsOne : ""
property hdecsTwo : ""
property hdecsThree : ""
set filepath to "DistillerIHT:In:" as Unicode text
tell application "Illustrator CS"
activate
set user interaction level to never interact
set OldDelims to AppleScript's text item delimiters
tell document 1
set wn to get width as number as text
set wi to get width as integer
set hn to get height as number as text
set hi to get height as integer
end tell
set AppleScript's text item delimiters to "."
try
set wdecs to the second text item of wn as text
end try
try
set hdecs to the second text item of hn as text
end try
set AppleScript's text item delimiters to ""
try
set wdecsOne to the first text item of wdecs as text
end try
try
set wdecsTwo to the second text item of wdecs as text
end try
try
set wdecsThree to the third text item of wdecs as text
end try
try
set hdecsOne to the first text item of hdecs as text
end try
try
set hdecsTwo to the second text item of hdecs as text
end try
try
set hdecsThree to the third text item of hdecs as text
end try
set theWidth to wi & "." & wdecsOne & wdecsTwo & wdecsThree as text
set theHeight to hi & "." & hdecsOne & hdecsTwo & hdecsThree as text
--set paperProps to {class:paper properties, custom paper:true, height:theHeight, width:theWidth}
--set thePaper to {class:paper, properties:paperProps}
set thisDoc to name of current document as text
set FullPath to filepath & thisDoc & ".ps"
set ppdFileName to "Adobe PDF" as Unicode text
set paperOpts to {class:paper options, height:theHeight, width:theWidth}
set postOpts to {class:postscript options, PostScript:level 2}
set jobOpts to {class:job options, print as bitmap:false, file path:FullPath}
set printOpts to {class:print options, job settings:jobOpts, paper settings:paperOpts, postscript settings:postOpts, printer name:"Adobe Postscript® File", PPD name:ppdFileName}
print current document options printOpts without dialogs
end tell
I cannot figure out how to set a custom paper size. You can see that I’ve tried a number of different ways of going about it. The awkward thing about is…when I have the paper settings in the job, print, or postscript options, the error it returns is on the last line. It can’t get the current document.
As you can see this script determines the size of the document and is supposed to use the determined size in the script. It needs to do this to be dynamic. It’s just not working out though.
Any insight…anyone?