Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Print with Print Presets

Explorer ,
Dec 13, 2016 Dec 13, 2016

Copy link to clipboard

Copied

I'm totally missing what should be an obvious script... but I've tried several options that I've found in various forums... and I've yet to suceed...

I simply need a script that I can print the current document based on a Print Preset "PrintMe" and I'd prefer it to have no user interactions... just simply print..

Any help?

TOPICS
Scripting

Views

1.1K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Dec 14, 2016 Dec 14, 2016
Hi,  Babymac08!Try this code:var storeUserInteract = userInteractionLevel;var d                 = activeDocument;var filePath          = '/d/test_prnt.ps' // your print file namevar jbOpts            = new PrintJobOptions();var opts              = new PrintOptions();opts.printPreset      = "PrintMe";opts.jobOptions       = jbOpts;jbOpts.file           = new File(filePath);userInteractionLevel  = UserInteractionLevel.DONTDISPLAYALERTS;d.print(opts);userInteractionLevel = storeUserInteract;

Likes

Translate

Translate
Engaged ,
Dec 14, 2016 Dec 14, 2016

Copy link to clipboard

Copied

Hi,  Babymac08!

Try this code:

var storeUserInteract = userInteractionLevel;

var d                 = activeDocument;

var filePath          = '/d/test_prnt.ps' // your print file name

var jbOpts            = new PrintJobOptions();

var opts              = new PrintOptions();

opts.printPreset      = "PrintMe";

opts.jobOptions       = jbOpts;

jbOpts.file           = new File(filePath);

userInteractionLevel  = UserInteractionLevel.DONTDISPLAYALERTS;

d.print(opts);

userInteractionLevel = storeUserInteract;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2016 Dec 14, 2016

Copy link to clipboard

Copied

Thank you so much... Works perfect

I did modify slightly to remove the file path option and it worked flawlessly...

var storeUserInteract = userInteractionLevel; 

var d                 = activeDocument; 

var jbOpts            = new PrintJobOptions(); 

var opts              = new PrintOptions(); 

opts.printPreset      = "PrintMe";  //Insert Your Own Custom Print preset between quotes

opts.jobOptions       = jbOpts; 

userInteractionLevel  = UserInteractionLevel.DONTDISPLAYALERTS; 

d.print(opts); 

userInteractionLevel = storeUserInteract; 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 30, 2021 Apr 30, 2021

Copy link to clipboard

Copied

LATEST

Okay later I'm also using this script which allows me to print to a printer preset. But in reality this printer that I use is not real printer but a virtual printer to genrate PDFs with color seprations. So later he also ask me where to save the generated PDF: Do u know how I can give him the command to save it to me in the usual folder with a suffix (in this case + sep) ? thank you very much indeed

 

var storeUserInteract = userInteractionLevel;

var d = activeDocument;

var jbOpts = new PrintJobOptions();

var opts = new PrintOptions();

opts.printPreset = "separazioni"; //Insert Your Own Custom Print preset between quotes

opts.jobOptions = jbOpts;

userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

d.print(opts);

userInteractionLevel = storeUserInteract;

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

I'm sure this works if you are working on a script from within Illustrator.  I am working on a script that updates the version and copyright year of 30 CD labels.  This was working with a previous version of Illustrator.  We have since upgraded to CS3 ().  However, it is an external JavaScript script (.js).  It successfully opens the file, updates the the appropriate text fields, and saves the modified file.  However, when I print (using a printer driver that prints to a file), it asks for a file to print to.  Since each .prn file will have the same base name as the Illustrator file, I can't include the file name in the printer driver settings.  I see in the Illustrator.jobOptions the is a 'file' member of type File.  This appears to be an internal File object rather than a FileSystemObject File.  Is there a way I can specify the filename of the output file when printing?

BTW, the documentation for using external JavaScript scripts says that it is 'beyond the scope of the documentation'.  It's actually no more difficult than writing external VBScript scripts.  You just use new ActiveXObject() instead of CreateObject().

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 01, 2017 Feb 01, 2017

Copy link to clipboard

Copied

Figured it out.  I followed the suggestion for VBScript and ran MS Word's VBA editor and looked at the Illustrator object model with the object browser.  The spec' for the File member of PrintJobOptions is just String.  So, I created a PrintJobOptions object, set the File member to the name of the file I wanted to print to, and set the PrintOptions.jobOptions member to the PrintJobOptions that I had just created.  It works great.  Thanks anyway.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines