Concatenation not showing
I am working on a document that contains several sections and each of them contains 4 pages numbered from 1 to 4.
I would like to be able to name the pages of my document so that they are named as follows:
TEST1-1, TEST1-2, TEST1-3, TEST1-4 for the first section
then TEST2-1, TEST2-2, TEST2-3, TEST2-4 for the second section and so on.
I managed to create the code in question for creating my sections and renaming my pages from 1 to 4 for each section but it does not put the "-" sign for me after the number of my sections.
Can you help me to find a solution so that the concatenation is done well.
here is my current code:
var doc = app.activeDocument;
var months = ["TEST"];
var daysInMonth = 4;
var sectionStart = 0;
var pageCounter = 1;
var sectionCounter = 1;
while (sectionStart < doc.pages.length) {
var sectionEnd = sectionStart + daysInMonth;
var section = doc.sections.add(doc.pages.item(sectionStart), doc.pages.item(Math.min(sectionEnd - 1, doc.pages.length - 1)));
section.name = months + sectionCounter;
section.continueNumbering = false;
section.pageNumberStart = 1;
sectionStart = sectionEnd;
for (var j = sectionStart - daysInMonth; j < sectionEnd && j < doc.pages.length; j++) {
doc.pages.item(j).label = section.name+"-"+pageCounter;
pageCounter++;
}
pageCounter = 1;
sectionCounter++;
}
Thank you in advance for your assistance

