Copy link to clipboard
Copied
Hello everyone! I have a question to ask.
I have added Tags ABCD in InDesign, and I want to use a script to change the color of these Tags during the operation, to distinguish between the state before and after the operation.
I have reviewed some related materials and found that the color of Tags can only be set when adding an XMLTag, but I can't find a way to modify the color of existing Tags using a script.
I hope someone can guide me.
Thank you all!
Hi @Aprking, I don't understand what's going wrong. I just tried it here and it worked, for example:
app.activeDocument.xmlTags[1].tagColor = [200, 50, 255];
Does this work for you?
- Mark
Copy link to clipboard
Copied
Hi @Aprking, I don't understand what's going wrong. I just tried it here and it worked, for example:
app.activeDocument.xmlTags[1].tagColor = [200, 50, 255];
Does this work for you?
- Mark
Copy link to clipboard
Copied
Thank you to @m1b for your help. I have successfully completed the code to change the tagColor.
The previous failure was caused by other errors in the code. Thanks again!
var doc = app.activeDocument;
var xmlTags = doc.xmlTags;
for (var i = 0; i < xmlTags.length; i++) {
if (xmlTags[i].name == "A") {
xmlTags[i].tagColor = 1766025324;
break;
}
}
Copy link to clipboard
Copied
You're welcome. Hope your script goes great.