Skip to main content
Robert at ID-Tasker
Legend
August 10, 2023
Question

Why Endnotes are so broken in DOM / Scripting ...

  • August 10, 2023
  • 2 replies
  • 473 views

Anyone knows why Endnotes are so broken ?

 

Footnotes - are available for all Text objects:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Footnotes.html

Object of

Cell.footnotes

Table.footnotes

Text.footnotes

Character.footnotes

Word.footnotes

Line.footnotes

TextColumn.footnotes

Paragraph.footnotes

TextStyleRange.footnotes

InsertionPoint.footnotes

TextFrame.footnotes

Story.footnotes

EndnoteTextFrame.footnotes

XmlStory.footnotes

 

But Endnotes:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Endnotes.html

Object of

Cell.endnotes

Table.endnotes

InsertionPoint.endnotes

Story.endnotes

XmlStory.endnotes

 

So you can't iterate through Paragraphs and their Endnotes directly.

 

Another strange thing - I can't iterate through Story declared in VB as InDesign.Story - I need to declare it as a Variant - otherwise, if I try to iterate through Endnotes of the Story - I get Misatch error stright away on:

 

For c = 1 To myLStory.Endnotes.Count

 

But I can iterate through Footnotes without a problem.

 

Then, I can't declare Endnote as InDesign.Endnote - I also need to declare it as a Variant.

 

Dim myLEndnote As Variant ' InDesign.Endnote
Dim myLStory As Variant ' InDesign.Story

 

And on top of that - I can't store a reference to it directly:

 

Set qqq = myLEndnote

 

I need to save extra reference to the .ParentStory to be able to "find" footnote using .ItemByID

 

(end of rant)

 

This topic has been closed for replies.

2 replies

Peter Kahrel
Community Expert
Community Expert
August 11, 2023

Adobe did a pretty bad job with the scripting APIs for endnotes. It should have been parallel to the footnote scripting APIs. Some of the most glaring problems were fixed in a prerelease round, but as you noted, Robert, many problems remain.

 

I can add to your woes: to create a footnote at an insertion point, you do the entirely expected 

 

myInsertionPoint.footnotes.add()

 

But to insert an endnote, you do

 

myInsertionPoint.createEndnote()

 

The problem at one point was (not only with footnotes) that the engineer responsible for adding some scripting APIs didn't check how things were generally done in InDesign, but rather followed what they thought might make sense (it usually didn't). It's a sad reality that we have to live with.

Community Expert
August 11, 2023

Hi @Robert at ID-Tasker,

You already know that this can only be answered by Adobe folks. I don't think existing functionality/API interface has been changed or bugs have been fixed for Extendscript in a long time, VBScript is something no one even seems to talk untill you  started participating on the forums. I would pin my hopes more on UXP for such fixes.

-Manan

-Manan
Community Expert
August 11, 2023

@Manan Joshi said: "I would pin my hopes more on UXP for such fixes."

 

Hi together,

I would not. I do think, that the function is designed as it is. With bugs and very unlucky design decisions. Primary task for the developers would be to fix the bugs and revise design decisions. All in all a totally feature revamp would be needed. Endnotes 2.0.

 

See Marc Autret's article:

InDesign Scripting: Why are Endnotes so Hard to Decipher?
Marc Autret, June 03, 2023

https://indiscripts.com/post/2023/06/indesign-scripting-why-are-endnotes-so-hard-to-decipher

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Robert at ID-Tasker
Legend
August 11, 2023

Thanks for the link. 

 

Yeah, I've got to exactly the same conclusion yesterday. 

 

Fortunately workaround is pretty simple - for me - analyse ParentStory and store both IDs. 

 

But I don't understand why Endnotes are treated that way - that they can be bunch of characters anywhere in this dedicated Story? Is this really used in real world? That you can put extra text around? 

If they were treated the same as Footnotes - it would be much easier for everyone.