Page Change Footnote Number Change
Following is my code which adds a number same as footnote number at the end of the footnote. I need that for some reason. This code works fine if in Document Footnote Options, I have not selected to change the footnote number on every page. But when I select to change the footnote number on every page option in InDesign, this code looses its purpose. I need to write something which resets the counter back to 1 on the next page. I have 27 pages each containing one text frame and 27 pages are threaded together. Each frame has at least 1 multi line footnotes. Please help.
convert();
function convert() {
myDocument = app.activeDocument;
var pageCount = myDocument.pages.length;
//Reset all the Grep preferences first
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
//Enter the GREP pattern to search
app.findGrepPreferences.findWhat = "~F~>\\K(.+)";
//Execute the Find GREP
var p = app.activeDocument.findGrep();
//If GREP does not return any matches, alert the user
if (p.length == 0) { alert('GREP did not return any matches'); exit()}
//Iterate through the found items and add a number same as footnote at the end
//A space is added before a Number
for (var i=0; i<p.length; i++)
p[i].contents += " " + (i+1);
//Reset all the Grep preferences for next use
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
}
The code is working perfectly fine but when I change document footnote option to change the footnote number on every page, this code needs to be reset which I am not able to do. Any help will be appreciated.
Thanks
