Thank you Chinna, thank you so much, geat for you to help, appreciate!
but I still continued to seek my second version
var doc = app.documents;
app.findTextPreferences = null;
app.findTextPreferences.underline = true;
app.findTextPreferences.underlineColour = red; <-------------- Can I add this line?
for(var i=0;i<doc.length;i++)
{
var found = doc[i].findText();
var _pages = [];
for(var j=0;j<found.length;j++)
{
var txfms = found[j].texts[0].parentTextFrames;
for(var k=0;k<txfms.length;k++)
{
_pages.push(txfms[k].parentPage.name);
}
}
for(var j=0;j<_pages.length;j++)
{
if(_pages[j] === _pages[j-1])
{
_pages.splice(j,1);
}
}
if(_pages.length != 0)
{
app.pdfExportPreferences.pageRange = _pages.toString();
doc[i].exportFile(ExportFormat.PDF_TYPE, new File(doc[i].fullName.toString().replace(/\.indd$/i,".pdf")), false);
}
_pages = [];
}
app.findTextPreferences = null;