Answered
Script to change of the group of multiple grouped text
- August 26, 2022
- 2 replies
- 285 views
Hello Everyone,
I have previously posted the query in changing the color of the selected text in group and outside the group and I got answer aswell.
But, I got a new problem that the script was not changing the selected group item containing mutliple group item of texts inside that group.
docRef = app.activeDocument;
var color1 = new CMYKColor();
color1.cyan = 100;
color1.magenta = 0;
color1.yellow = 0;
color1.black = 0;
var spot = docRef.spots.add();
spot.color = color1;
spot.colorType = ColorModel.SPOT;
spot.name = "Keyline Blue";
var selectedObjects = docRef.selection;
for (var i = 0; i < selectedObjects.length; i++) {
if (selectedObjects[i].typename == "TextFrame") {
selectedObjects[i].textRange.fillColor = spot.color;
} else if (selectedObjects[i].typename == "GroupItem") {
for (var t = 0; t < selectedObjects[i].textFrames.length; t++) {
selectedObjects[i].textFrames[t].textRange.fillColor = spot.color;
}
}
}
Help me in this concern, I am attaching the script that work for the one group item, and also am attaching the sample there its not working.