Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Convert Footnotes and Endnotes bug + bonus scripting bug

Return to Member Forum

  • Author
    Posts
    • #14364878

      I just posted this bug to Adobe, some might find it interesting.

      Convert Footnotes and Endnotes does not work when the footnotes does not have a footnote number.

      I have an Indesign document with footnotes.
      In each footnote I have removed the footnote number and the following tab character. (~F)

      I need these footnotes to be endnotes but this is not possible with the command “Convert Footnotes and Endnotes”.

      Without the footnote number in the footnotes the command/script does not recognise the footnotes as being footnotes.

      They are however still footnotes and I can continue working with them as footnotes and also address them via scripting but the command “Convert Footnotes and Endnotes” does not work.

      I can reinsert a footnote number in each of the footnotes manually one by one by going through “Special Characters > Markers > Footnote Number.

      This will make the conversion work but this should not be necessary.

      Now to the bonus problem:

      I figured I could simply iterate the footnotes and insert the footnote number with a simple script. Guess what? Not that simple.

      I can insert everything except for the SpecialCharacters.FOOTNOTE_SYMBOL in the footnotes.
      Looking at the undo menu it appears as if indesign thinks it has inserted something as it says: “Undo Insert Text”
      But nothing was inserted.

      I have scripted a workaround where I make a temporary footnote and just copy the footnote number from that to be inserted in the original footnotes.

    • #14364891

      Dang! That block quote tag sure is effective. Sorry for screaming.

      • #14364892
        David Blatner
        Keymaster

        LOL. No worries, Magnus. Our fault… we need to get that CSS formatting fixed for the forum!

    • #14364995

      For anyone interested the script below will insert footnote numbers back into all footnotes.


      var scriptName = File($.fileName).name;
      app.scriptPreferences.enableRedraw = false; //Does not seem to work in this case

      Application.prototype.main = function() {
      var theDoc = app.activeDocument;
      var theStory;
      try{
      theStory = app.selection[0].parentStory;
      }
      catch(e)
      {
      alert("Place cursor i story with footnotes and try again");
      exit();
      }
      var theFootnotes = theStory.footnotes.everyItem().getElements();
      var theCounter = 0;

      //progressbar setup
      var w = new Window('palette', 'Inserting footnote numbers ...', {x:200, y:200, width:350, height:70});
      w.pbar = w.add('progressbar', {x:25, y:12, width:300, height:12}, 0, theFootnotes.length);
      w.st = w.add('statictext', {x:10, y:36, width:320, height:20}, '');
      w.st.justify = 'center';
      w.show();

      //new temporary footnote
      var tempNote = theStory.insertionPoints[-1].footnotes.add();

      //Select and copy text from the temp footnote
      var theFootnoteNumber = tempNote.texts[0]; //includes both the number and the following tab character
      app.select(theFootnoteNumber);
      app.copy();

      // remove temp footnote
      tempNote.remove();

      //iterate existing footnotes and insert footnotenumber
      for (var i = theFootnotes.length-1; i >= 0 ; i--) {
      app.select(theFootnotes[i].paragraphs[0].insertionPoints[0]);
      app.paste();
      theCounter++;
      w.pbar.value = theFootnotes.length-i;
      w.st.text = "Processing item " + w.pbar.value + " of " + theFootnotes.length + " total";
      }
      alert("Inserted footnote number in " + theCounter + " footnotes.");
      }
      app.doScript('app.main();',ScriptLanguage.JAVASCRIPT,undefined,UndoModes.ENTIRE_SCRIPT,scriptName);

Viewing 2 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads