OK, was in a hurry, see that the new is a resreved word, this should be closer, there are no errors but no text output, I'll keep trying...
//Process the paragraphs and tables in the main document flow
var textList, count = 0, i = 0, tbl = 0, pgf = 0;
var tagsFile = new File ("C:\extend\tag_list.txt")
// Turn off the document display to speed the script and
// prevent screen flicker.
if (app.Displaying == 1) {
app.Displaying = 0;
}
//Process each top-level paragraph in document
tagsFile.open("a");
pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;
while (pgf.ObjectValid()) {
//!! applyNewPgfFmt(pgf,doc);
tagsFile.writeln (pgf.NextPgfInFlow);
// pgf = pgf.NextPgfInFlow;
}
tagsFile.close();