Hi, I am working on a document which contains a lot of footnotes with many footnotes having more than one paragraph. Each footnote has a common reference and marker "\[\d+\]". To cite with an example: Footnote 1 text has two paragraphs whereas Footnote 2 text has only one paragraph break. Thanks to Mr. Kahrel's footnote script (grateful for his effort and time), if the footnote references and texts have the same GREP marker, then, the footnotes can can be placed with the help of the script, however, the script just takes one paragraph break into account. Kahrel sir's script: //Footnote if (parseFloat(app.version) < 6) main(); else app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Footnote"); function main() { var myDoc = app.activeDocument, mStory = app.selection[0].texts[0].parentStory, mEndNotes = myDoc.textFrames.add( {name:"EndNotes"} ), k, len, cIP, currPara, currFoot, mMarkers; app.findGrepPreferences = app.changeGrepPreferences = null; //--------------------------------------------- // edit doc.footnoteOption here with (myDoc.footnoteOptions) { showPrefixSuffix = FootnotePrefixSuffix.PREFIX_SUFFIX_BOTH; prefix = "["; suffix = "]"; separatorText = "\t"; markerPositioning = FootnoteMarkerPositioning.NORMAL_MARKER; } //------------------------------------------------------------ // move endnotes to a separate textFrame for (k=mStory.paragraphs.length - 1; k >=0; k--) { if (mStory.paragraphs .contents.search(/^\[\d+\]/) == 0) { currPara = mStory.paragraphs .move(LocationOptions.AT_BEGINNING, mEndNotes.parentStory); currPara.words[0].remove(); } } //-------------------------------------- // create footnote markers app.findGrepPreferences.findWhat = "\\[\\d+\\]"; mMarkers = mStory.findGrep(); len = mMarkers.length; while (len-->0) { cIP = mMarkers[len].insertionPoints[0].index; mMarkers[len].remove(); mStory.footnotes.add( LocationOptions.AFTER, mStory.insertionPoints[cIP] ); } //------------------------------------------------------- // fill footnote contents with proper text for (k=0; k < mStory.footnotes.length; k++) { currFoot = mStory.footnotes ; mEndNotes.paragraphs[0].texts[0].move(LocationOptions.AT_END, currFoot.texts[0]); if (mStory.footnotes .characters[-1].contents == "\r") mStory.footnotes .characters[-1].remove(); } mEndNotes.remove(); } Is it possible to tweak the script in such a way that it takes all the paragraph breaks just before the next text marker or if I define a particular paragraph style to the footnote text then, it picks up all the paragraphs having the footnote paragraph style till it finds the next footnote marker? Result: Any kind of help/advise would be greatly appreciated. Thanks & Regards, Aman Mittal
... View more