Answered
Print Dialog Presets - Change Default DuplexMode attribute
- July 15, 2020
- 1 reply
- 1344 views
Sure !
Below is a script that I was able to figure out to help another user.
I started learning JavaScript in January 2020 (still learning), and in about a month and a half I was able to come up with this:
app.alert("Document is now Printing");
var pp2 = this.getPrintParams();
pp2.firstPage = 2;
pp2.lastPage = 6;
pp2.interactive = pp2.constants.interactionLevel.automatic;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;
pp2.printerName = "";
if (this.getField("CH.2").value == "Yes") {this.print(pp2)};
var p2 = app.thermometer;
p2.duration = this.print(pp2);
p2.begin();
for ( var i = 0; i < this.print(pp2); i++)
{
p2.value = i;
p2.text = "Printing pages 3-5"; break;
}
p2.end();
var pp4 = this.getPrintParams();
pp4.firstPage = 9;
pp4.lastPage = 9;
pp4.interactive = pp4.constants.interactionLevel.automatic;
pp4.DuplexType = pp4.constants.duplexTypes.simplex;
pp4.pageHandling = pp4.constants.handling.fit;
pp4.printerName = "";
if (this.getField("CH.4").value == "Yes") {this.print(pp4)};
var p4 = app.thermometer;
p4.duration = this.print(pp2);
p4.begin();
for ( var i = 0; i < this.print(pp4); i++)
{
p4.value = i;
p4.text = "Printing page 8"; break;
}
p4.end();
var pp6 = this.getPrintParams();
pp6.firstPage = 11;
pp6.lastPage = 16;
pp6.interactive = pp6.constants.interactionLevel.automatic;
pp6.DuplexType = pp6.constants.duplexTypes.DuplexFlipLongEdge;
pp6.pageHandling = pp6.constants.handling.fit;
pp6.printerName = "";
if (this.getField("CH.6").value == "Yes") {this.print(pp6)};
var p6 = app.thermometer;
p6.duration = this.print(pp6);
p6.begin();
for ( var i = 0; i < this.print(pp6); i++)
{
p6.value = i;
p6.text = "Printing pages 10-15"; break;
}
p6.end();
var pp8 = this.getPrintParams();
pp8.firstPage = 17;
pp8.lastPage = 17;
pp8.interactive = pp8.constants.interactionLevel.automatic;
pp8.DuplexType = pp8.constants.duplexTypes.simplex;
pp8.pageHandling = pp8.constants.handling.fit;
pp8.printerName = "";
if (this.getField("CH.8").value == "Yes") {this.print(pp8)};
var p8 = app.thermometer;
p8.duration = this.print(pp8);
p8.begin();
for ( var i = 0; i < this.print(pp8); i++)
{
p8.value = i;
p8.text = "Printing page 16"; break;
}
p8.end();
var pp9 = this.getPrintParams();
pp9.printRange=[[22,22]]
pp9.printRange.push([23,24]);
pp9.interactive = pp9.constants.interactionLevel.silent;
pp9.pageHandling = pp9.constants.handling.fit;
pp9.printerName = "";
this.print(pp9);
var p9 = app.thermometer;
p9.duration = this.print(pp9);
p9.begin();
for ( var i = 0; i < this.print(pp9); i++)
{
p9.value = i;
p9.text = "Printing pages 21-23"; break;
}
p9.end();
You can use the original discussion as a reference here (back in 17 February 20202): Print based on boxes checked
And there are plenty of excellent tutorials and discussions here in the forums that you can search and find useful.
But everything you need to know about the getPrintParams method is very clearly explained with examples in the following guidance:
So with some reading it is really not that complicated. It could get really complicated though.
Be aware that the reference above is almost 800 pages long, so happy reading!
NOTE:
In my personal opinion, I did all the work for that other user and the individual never marked my solution as correct answer; that kind of hurt my "Adobe" wannabe..neverwas... Alter-ego ... specially after so much effort.
But anyway, there's an old Japanese proverb that one old teacher shared with me when I was younger:
"Empty yourself completely to be filled up abundantly"
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.