Hi, This is sample script
var findSize = "12";
var changeSize = "20";
var doc = app.ActiveDoc;
var pgf = doc.TextSelection.beg.obj;
main(pgf, doc);
function main (pgf, doc) {
var end = Constants.FV_OBJ_END_OFFSET - 1, begin = 0, textRange;
var textList = pgf.GetText (Constants.FTI_CharPropsChange);
for (var i = textList.length - 1; i >= 0; i -= 1) {
begin = textList[i].offset;
if (begin !== end) {
textRange = new TextRange (new TextLoc (pgf, begin), new TextLoc (pgf, end));
var oProp = doc.GetTextPropVal(textRange.beg, Constants.FP_FontSize);
if(oProp.propVal.ival / 65536 == Number(findSize)){
newVal = 65536 * changeSize;
prop = new PropVal ();
prop.propIdent.num = Constants.FP_FontSize;
prop.propVal.valType = Constants.FT_Metric;
prop.propVal.val = newVal;
doc.SetTextPropVal (textRange, prop);
}
end = begin;
}
}
if (end > 0) {
textRange = new TextRange (new TextLoc (pgf,0), new TextLoc (pgf,end));
var oProp = doc.GetTextPropVal(textRange.beg, Constants.FP_FontSize);
if(oProp.propVal.ival / 65536 == Number(findSize)){
newVal = 65536 * Number(changeSize);
prop = new PropVal ();
prop.propIdent.num = Constants.FP_FontSize;
prop.propVal.valType = Constants.FT_Metric;
prop.propVal.val = newVal;
doc.SetTextPropVal (textRange, prop);
}
}
}
The above script found text which have font size 12pt successfully.. but did not changed to the size 20pt.. i think it changed by default size..
is there any mistake in the above script?