Thanks Rick, I was able to figure most steps out using your script as starting point, but I'm stuck at the final bit, so I hope someone can tell me what I'm missing here.
here's the script I use :
var doc = app.ActiveDoc;
var pgf = doc.FirstPgfInDoc;
var log = "";
var CharTagVal = "";
var CharFont = "";
while(pgf.ObjectValid())
{
//ignore master page paragraphs
if(pgf.Name.indexOf("¦") === -1){
cleanPgf();
}
pgf = pgf.NextPgfInDoc;
}
function cleanPgf(){
var textList = pgf.GetText (Constants.FTI_CharPropsChange);
var begOffset = 0, endOffset = 0, textRange;
for (var i = 0; i < textList.length; i += 1) {
endOffset = textList[i].offset;
if (endOffset > begOffset) {
textRange = new TextRange(new TextLoc (pgf, begOffset), new TextLoc (pgf, endOffset));
doc.TextSelection = textRange;
SetCharVal(textRange);
begOffset = endOffset;
}
}
textRange = new TextRange(new TextLoc (pgf, begOffset), new TextLoc (pgf, Constants.FV_OBJ_END_OFFSET));
doc.TextSelection = textRange;
SetCharVal(textRange);
}
function SetCharVal(textRange){
var CharTag = doc.GetTextPropVal(textRange.beg, Constants.FP_CharTag);
var FontPlatformName = doc.GetTextPropVal(textRange.beg, Constants.FP_FontPlatformName);
FontPlatformName = FontPlatformName.propVal.sval;
CharFmtId = doc.GetNamedObject(Constants.FO_CharFmt, "symbol");
props = doc.GetProps(CharFmtId);
if (/symbol/i.test(FontPlatformName) === true) {
//alert (CharTag.propVal.sval + " - " + FontPlatformName );
doc.SetTextProps(textRange, props);
}
}
I managed to get the script run through all the paragraphs, ignores the irrelevant ones, and each time the script sees the symbol font it should add the charformat. This however doesn't work as I was hoping for, it sees the textRange, but instead of adding the hoped for chartag, it sets teh default setting, actually clearing out the format. I assume I'm doing something wrong when setting the props, but have no clue what it could be.
Any suggestion ?
Thanks,
Koen