Copy link to clipboard
Copied
I have a form that has 3 standard pages(fillable) with several templates arranged into three categories (instructions). I would like for the user to be able to print only the instructional pages needed by selecting them from a menu button. Is it possible to place the templates into an array by category that can be selected from a menu for printing?
var cChoice = app.popUpMenu( "Category A", "Category B", "Category C);
if (cChoice !=null){
switch (cChoice) {
case "Category A":
var a = new Array("Template_Page1", "Template_Page2", "Template_Page3", "Template_Page4","Template_Page5");
for (i = 0; i < a.length; i++){
a.spawn(this.numPages, false, false);}
//print Category A templates
break;
case "Category B":
var a = new Array("TemplateB_Page1", "TemplateB_Page2", "TemplateB_Page3");
for (i = 0; i < a.length; i++){
a.spawn(this.numPages, false, false);}
//print Category A templates
break;
case "Category B":
var a = new Array("TemplateC_Page1", "TemplateC_Page2", "TemplateC_Page3");
for (i = 0; i < a.length; i++){
a.spawn(this.numPages, false, false);}
//print Category A templates
break;
}
}
Copy link to clipboard
Copied
I miss this.getTemplate( ... ) in your code.
Copy link to clipboard
Copied
Okay, I am not sure where this.getTemplate(...) would go in my code. But here is my attempt at placing the missing statement in group A code.
var cChoice = app.popUpMenu( "Category A", "Category B", "Category C);
if (cChoice !=null){
switch (cChoice) {
case "Category A":
var a = new Array("Template_Page1", "Template_Page2", "Template_Page3", "Template_Page4","Template_Page5");
var b = this.getTemplate(a);
for (i = 0; i < b.length; i++){
b.spawn(this.numPages, false, false);}
//print Category A templates
break;
Copy link to clipboard
Copied
Read the documentation. The method getTemplate uses only one name as argument, no array.
Copy link to clipboard
Copied
Your code was close, but not quite there... It needs to be something like this:
var a = new Array("Template_Page1", "Template_Page2", "Template_Page3", "Template_Page4","Template_Page5");
for (i = 0; i < a.length; i++) {
var b = this.getTemplate(a);
b.spawn(this.numPages, false, false);
}
Copy link to clipboard
Copied
Thanks for the code assistance. My final code result was :
var a = this.templates
for (i = 0; i < 6{
a.spawn(this.numPages, false, false); }
print ....
Find more inspiration, events, and resources on the new Adobe Community
Explore Now