Hello fellows,
I am writing an extendscript that is supposed to loop through all pgfs and find all characters/strings with a certain condition applied (let's say, Comment).
The problem is that in the scripting guide, I could not find a function that retrieves the condition property of a character. I tried using the JS "charAt(i)" function, but it does not seem to work in ES. Any idea how to implement such a function?
Below is the 1st draft of the script.
var doc = app.ActiveDoc;
if doc.ObjectValid() {
checkCondFMt(doc);
}
else{
Alert("No section open");
}
function checkCondFMt(doc) {
var pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
var CondObj=doc.GetNamedObject("Comment");
while (pgf.ObjectValid()){
var textItems =pgf.GetText(Constants.FTI_String | Constants.FTI_LineEnd);
var tr = new TextRange();
tr.beg.obj = tr.end.obj = textItems;
tr.beg.offset = 0;
for (var i = 0; i < tr.len; i++ ) {
var c = tr.charAt(i);
var PgfProps =doc.GetTextVal(c[i], Constants.FO_CondFmt);
alert (PgfProps.Name);
}
pgf=pgf.NextPgfInFlow;
}
}
Thank you for your input in advance!