Greetings again,
That's exactly what I wanted, man. I can change the color names etc in my Swatches panel. But I think I'm making a mistake while multiplexing the code. You've already done a color change in 10 pages. How do I multiplex this? Likewise, I want to change the color every 10 pages. I have 5 main colors.
----------------------
var d = app.activeDocument;
var ps = d.pages;
var red = d.swatches.itemByName("RGB 01");
var blue = d.swatches.itemByName("RGB Blue");
for (var i = 0; i < ps.length; i++) {
if (i < 10) { ps[i].textFrames[0].parentStory.fillColor = red; }
else { ps[i].textFrames[0].parentStory.fillColor = blue; }
}
-----------------
can you multiplex through this code?
thank you for your help
I have no idea what multiplex means. But if you have five colors that you want to change every ten pages, then it would be:
//put all five swatch names below; leave the quote marks around them, and keep the comma structure
var snames = ["RGB 01", "RGB Blue", "RGB Orange", "RGB Yellow", "RGB Pink"];
var d = app.activeDocument;
var ps = d.pages;
var papel = d.swatches.itemByName("[Paper]");
var sw = "15 px";
var ix, parStor;
for (var i = 0; i < ps.length; i+=10) {
ix = i % 5;
for (var j = 0; j < 10; j++) {
try {
parStor = ps[j + i].textFrames[0].parentStory;
parStor.fillColor = d.swatches.itemByName(snames[ix]);
parStor.strokeColor = papel;
parStor.strokeWeight = sw;
} catch(e) {} //we try/catch to handle out of bounds on page length
}
}