Link in Zwischenablage kopieren
Kopiert
HI,
I am working on a document with more than 3000+ pages and have to cater to the footnotes accordingly, The footnote references are marked as , ,.... in the document and I am trying to use Jump Over's script (much Thanks to him for writing su...
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(/^\[[\l\u]\]/) == 0) {
currPara = mStory.paragraphs
.move(LocationOptions.AT_BEGINNING, mEndNotes.parentStory); currPara.words[0].remove();
}
}
//--------------------------------------
// create footnote markers
app.findGrepPreferences.findWhat = "\\[\\[\l\u]\\]";
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();
However, the script doesn't seem to do anything for the footnotes markers. Could anyone let me know, what am I doing wrong? Any help would be greatly appreciated.
Also, as the script caters to just one paragraph in the footnote (\r). Is there any way to add more than one?
Regards,
Aman Mittal
Link in Zwischenablage kopieren
Kopiert
Hi Aman,
basically that's the same question or field of problems that we discussed here in the InDesign Scripting Forum:
Script to convert text to foot note with "*"
To make that happen, more than one paragraph for the footnote text, you need a hook, a speciality with the footnote text that is unique to it so that a script can discern "normal" text from "footnote" text. If that is not given there is no way a script can help you.
Regards,
Uwe
Link in Zwischenablage kopieren
Kopiert
Hi Uwe,
Thank you for replying to the query. You are absolutely right! There is no way a script can differentiate between footnote text and normal text without any differentiating factor. However, in your previous discussion you talked about giving a paragraph style to footnotes. In case, I am able to do that and let's say, I name the paragraph style as - 'Footnote Para Style'. How would be tweak the above to script to incorporate the change?
Also, I would be grateful to you if you could help me out with '' reference search as well, even for a single paragraph break.
I shall be highly obliged to you.
Regards,
Aman
Link in Zwischenablage kopieren
Kopiert
Moving to InDesign Scripting forum
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen