Hi @patrickbcm ,
do you mean that character style [None] should be applied?
How about local style overrides? Should they be removed as well? Yes?
And is that "label" an XML Tag? If yes, the script code below could work.
Before you start the script code select one character in that BBB area of text.
The script needs that selection to find the associated XML Element.
// Get the applied XML Element of the selected character between the tags you want to clear the styles:
var appliedXmlElement = app.selection[0].texts[0].associatedXMLElements[0];
var tagName = appliedXmlElement.markupTag.name;
/*
If you already know the tag name do it that way:
var tagName = "MyTagName"; // Insert the name between the quotes.
*/
var doc = app.documents[0];
var noCharStyle = doc.characterStyles[0];
var xmlElementsArray = doc.xmlElements[0].evaluateXPathExpression("//"+tagName );
for( var n=0; n<xmlElementsArray.length; n++ )
{
xmlElementsArray[n].texts[0].applyCharacterStyle( noCharStyle );
xmlElementsArray[n].texts[0].clearOverrides( OverrideType.CHARACTER_ONLY );
};
Save the document before you run the script so that you can revert to the saved state of the document.
Regards,
Uwe Laubender
( Adobe Community Professional )