Hey guys hoping you might be able to point me in the right direction here. I'm a noob at scripting Illustrator and have been racking my brain over this script for a few days now. What i would like to achieve is creating a script that will print a Postscript file to a designated folder with no user interaction. This folder will be on an external volume but just trying to get it to a folder on my desktop at this point... so this is what i started with initially :
var myDoc = app.activeDocument;
var options = new PrintOptions();
options.printPreset="PS_print";
myDoc.print(options);
Simple, and it works except that i still have to designate the folder in which the PostScript will be saved.. so i did some digging and came across this code Muppet Mark created on a thread called " Script: print to PostScript" here
. i ran it through ExtendScript and it executed once fine only thing i need to change is where the file is saving. So i edited it and came up with this:
printPostScript();
function printPostScript(){
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var docPath, docs, opts, psPath;
jobOpts = new PrintJobOptions();
opts = new PrintOptions();
opts.printPreset = 'PS.print';
opts.jobOptions = jobOpts;
docPath = decodeURI( app.activeDocument.fullName );
psPath = new File( "~/Desktop/TEST" );
jobOpts.file = File( psPath );
app.activeDocument.print( opts );
app.activeDocument.close( SaveOptions.DONOTSAVECHANGES );
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;
}
problem is every time i use the userinteractionLevel command illustrator throws me an error for the line where its supposed to execute the actual printing
"app.activeDocument.print( opts );" Or at least im assuming the userinteractionLevel command is the culprit as Illustrator throws me the same error with the script that i started with now when it didnt before. If any of you guys could help me out here it would be appreciated!
Thanks