Skip to main content
A2D2
Inspiring
December 19, 2024
Question

Find/replace and converting footnotes/endnotes

  • December 19, 2024
  • 4 replies
  • 1373 views

Hello,

 

The latest versions of InDesign CC have the functionality for converting endnotes to footnotes or vice versa. This conversion can be for all notes in the document or select notes.

 

My question is whether specific notes can be found in the document based on formatting (e.g. with a GREP search) and then the found note is converted.

 

Consider the following footnotes in a document...

 

1. Bla bla note one.

2. [Lorem ipsum note two.]

3. Bla bla bla bla another note here.

4. [Eeny meeny miny mo.]

5. Ip dip do the cat has the flu.

 

So, I want to find the footnotes in square brackets. I know I can do this with a Grep search which would be something like:

 

Find:  ~F\t\[.+\]

Find format - Paragraph style: Footnote paragraph

 

The question is whether it is possible to covert the found text into an endnote other than manually through the right click options or TYPE > CONVERT FOOTNOTES AND ENDNOTES options.

 

Does this require a script or can it be done through Find/Replace?

 

If only there ws a way to select all of the required footnotes then the menu option could be used to convert them to endnotes. This would also work.

This topic has been closed for replies.

4 replies

Peter Kahrel
Community Expert
Community Expert
December 23, 2024

Sorry to be a spoilsport, but this is so simple there's no reason to be mysterious about it.

 

To use the script, test whether your search string finds all and only what you're looking for, then run it.

 

(function () {

  var start = app.activeDocument.footnoteOptions.separatorText.length+1;

  function footnoteToEndnote (fnote) {
    var endnote = fnote.storyOffset.createEndnote();
    
    fnote.texts[0].characters.itemByRange (start, -1).
      move (
        LocationOptions.AFTER, 
        endnote.insertionPoints[-1]
      );
    
    fnote.remove();
  }

  var fn = app.activeDocument.findGrep();
  for (var i = fn.length-1; i >= 0; i--) {
    footnoteToEndnote (fn[i].parent);
  }

}());

 

 

A2D2
A2D2Author
Inspiring
December 23, 2024

Thank you @Peter Kahrel , worked for me in CC2025.

 

But raises the questions as to whether your pre-CC2018 footnote to endnote script could be modified to convert SELECT FOOTNOTES BASED ON GREP MATCH ONLY, rather than coverting ALL footnotes.

 

I did take a look at the script but couldn't figure it out myself.

Peter Kahrel
Community Expert
Community Expert
December 23, 2024

You didn't mention pre-CC2018. Doing endnotes from search results in pre-2018 InDesign is no trivial matter. Better upgrade to ID 2024 or 2025.

FRIdNGE
December 21, 2024

Quickly [because of Christmas], Script written for a client in june 2021!  😉

 

https://youtu.be/WKLzitQa4Mw

https://youtu.be/mq5ZLL6O8AE

 

 

(^/)  The Jedi

Robert at ID-Tasker
Legend
December 21, 2024

@FRIdNGE

 

Is it all or nothing? 

 

The ones with "ref" in the body? 

 

FRIdNGE
December 21, 2024

Exactly what the op would like basing on a Grep F/R!  😉

 

(^/)

Robert at ID-Tasker
Legend
December 21, 2024

Here is the whole process - based on the file provided by A2D2 -- which shows, that ID-Tasker is perfectly fine with RTL texts as well.

 

THIS IS VERY IMPORTANT - Endnotes option NEEDS to be set to "On a New Page":

Otherwise, it will create bunch of separate TextFrames for each Endnote.

 

Let's load Footnotes in "( )":

As per screenshot - Arabic text is displayed in the IDT's UI as well.

 

I want to convert only those 3x selected:

 

After conversion - references are doubled:

 

And fixed: 

 

 

Now, what's left, is to test IDT on some Far East document.

 

Even the free version of ID-Tasker can do the whole process semi-automatically - each Footnote that needs conversion, has to be pre-selected - double-clicked on the list of the found results - which BatchMode do this automatically in the full / paid version. 

 

Peter Kahrel
Community Expert
Community Expert
December 19, 2024

Does this require a script or can it be done through Find/Replace?

 

Yes, this requires a script, it can't be done in the interface.