Hi, I try again
changed it into this:
but not error
//---------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
app.doScript('main()', ScriptLanguage.JAVASCRIPT, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Find-change num");
function main(){
for ( var i = 0; i < nDocs; i++ ) {
var curDoc = app.documents[i],
mPages = curDoc.masterSpreads.everyItem().pages.itemByRange(0, -1),
target = mPages.textFrames.everyItem().paragraphs.everyItem();
app.findGrepPreferences = changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\b20+\\b";
var found = app.selection[0].findGrep();
for(var i=0;i<found.length;i++)
{
app.findGrepPreferences = changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\d+";
var foundnum = found[f].findGrep();
var newnum = parseInt(foundnum[0].contents) + 1;
app.changeGrepPreferences.changeTo = newnum.toString();
found[i].changeGrep();
}
}
}
//---------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------
Teetan