Copy link to clipboard
Copied
Hello,
I have two paragraph styles for footnotes and two character styles for footnote references.
I need to write a script that detects the paragraph style applied to the footnote and, depending on that, apply a certain character style to the footnote reference.
If the footnote have applied the paragraph style no. 1, then on its reference must be applied the character style no. 1, and same for no. 2.
I don't know how to access the footnote reference and apply the needed character style.
Thanks in advance for your help.
Hi aditz_a,
every footnote object has a texts property.
To get the applied paragraph style of a given footnote text ( the first paragraph ) could work like that:
// Example with some footnotes in a text selection:
var textSelection = app.selection[0];
var footnotesArray = textSelection.footnotes.everyItem().getElements();
for( var n=0; n<footnotesArray.length; n++ )
{
var currentFootnote = footnotesArray[n];
var parent = currentFootnote.storyOffset.parent;
var index = currentFootnote.sto
...
Copy link to clipboard
Copied
Hi aditz_a,
every footnote object has a texts property.
To get the applied paragraph style of a given footnote text ( the first paragraph ) could work like that:
// Example with some footnotes in a text selection:
var textSelection = app.selection[0];
var footnotesArray = textSelection.footnotes.everyItem().getElements();
for( var n=0; n<footnotesArray.length; n++ )
{
var currentFootnote = footnotesArray[n];
var parent = currentFootnote.storyOffset.parent;
var index = currentFootnote.storyOffset.index;
var footnoteSpecialChar = parent.characters[ index ];
var footnoteText = currentFootnote.texts;
var appliedParaStyle = footnoteText.insertionPoints[0].appliedParagraphStyle;
/*
Now test the appliedParaStyle and apply the right character style to:
footnoteSpecialChar
*/
};
All available properties for footnotes are listed e.g. here:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Footnote.html
Regards,
Uwe Laubender
( ACP )
// EDITED CODE
Copy link to clipboard
Copied
Thank you, very very much!
It worked like a charm. 🙂