Reply To: Use GREP to Put In Footnote Reference

Home Page / Forums / General InDesign Topics (CLOSED) / Use GREP to Put In Footnote Reference / Reply To: Use GREP to Put In Footnote Reference

#87782
Peter Kahrel
Participant

Emiel,

If your dummy footnotes are formatted [[Abc]] and a footnote should be created with content Abc to replace [[Abc]], then you’d need something like this script:

(function () {
  var i;
  var placeholders;
  var fnote;
  app.findGrepPreferences = null;
  app.findGrepPreferences.findWhat = '[[(.+?)]]';
  placeholders = app.documents[0].findGrep();
  for (i = placeholders.length-1; i >= 0; i--) {
    fnote = placeholders[i].insertionPoints[0].footnotes.add();
    placeholders[i].move (LocationOptions.AFTER, fnote.insertionPoints[-1]);
  }
}());

You end up with [[ and ]] in your footnotes, which you can remove with some find/replace operation.

Peter

This article was last modified on August 24, 2016

Comments (0)

Loading comments...