• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Convert Text to Footnote

New Here ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

Hi,

i used Jarek Jump_Over script "Convert Text to Footnote" and it really worked good for me. however, when i have two paragraphs in a note and i convert it to footnotes using the script, the script does not put the second paragraph together with the first in the new converted footnote, rather it leaves it behind, it would be grately appreciated if there is a way to change something in the script that includes all paragraphs in a note.

Thank you.

see pictures in link

unnamed.png - Google Drive

unnamed (1).png - Google Drive

TOPICS
Scripting

Views

220

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 15, 2019 Feb 15, 2019

Copy link to clipboard

Copied

LATEST

Try the edited version of the original script, I obtained the base version for my edit from the following link

Re: convert text to footnote

thanks toJump_Over for the nice original script, i would like his comments if he sees anything lacking in my tweak of his original thought

//Convert Text Footnote

//Original Author :- Jump_Over

//Edited By :- Manan Joshi

var

    myDoc = app.activeDocument,

    mStory = myDoc.textFrames.item("story").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

app.findGrepPreferences.findWhat = "^\\[\\d+\\].+(\r){0,1}(.*\r)*"

var eNote = mStory.findGrep();

for (k=eNote.length - 1; k >=0; k--)

{

    currPara = eNote.move(LocationOptions.AT_BEGINNING, mEndNotes.parentStory);

}

//--------------------------------------

// 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

app.findGrepPreferences.findWhat = "^\\[\\d+\\].+(\r){0,1}(.*\r)*"

var eNote = mEndNotes.parentStory.findGrep();

for (k=0; k < mStory.footnotes.length; k++)

{

    currFoot = mStory.footnotes;

    eNote.move(LocationOptions.AT_END, currFoot.texts[0]);

    currFoot.words[1].remove()

    if (mStory.footnotes.characters[-1].contents == "\r") mStory.footnotes.characters[-1].remove();

}

mEndNotes.remove();

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines