2 Replies Latest reply on Feb 8, 2011 10:46 AM by Natee1994

    Generating a footnote from selected text

    Natee1994

      I am trying to script InDesign CS4 using ExtendScript. I  want the script to cut the selected text, insert a footnote and paste  the text into the footnote body. What I have tried:

       

       function makeFootnoteOfSelection(){
         var fnText = app.activeDocument.selection[0];
               // this should actually clone the selected text, not reference it, because the next statement zaps it from memory
         app.activeDocument.selection[0].remove();  // works
         var fNote = app.activeDocument.selection[0].footnotes.add();  // works, adds an empty footnote with a reference
         fNote.contents = fnText.contents;
               // this replaces the reference number, I was hoping to retain it and just add the text
               // fNote.contents += fnText.contents; also replaces the reference number
      }

      Any help will be greatly appreciated.