Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Convert text to footnotes with alphabet tag

Entdecker ,
May 27, 2018 May 27, 2018

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

THEMEN
Skripterstellung
462
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
May 28, 2018 May 28, 2018

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

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Entdecker ,
May 28, 2018 May 28, 2018

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

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
May 28, 2018 May 28, 2018
AKTUELL

Moving to InDesign Scripting forum

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines