In InDesign Scripting (UXP): What is the correct way to react to a change to the active Document. By this I mean:
- A document is being opened
- A document is being closed
- The user switches from one opened document to another
- any other change to the active document
Sadly, I found no documentation on all the events supported by ‘Application’.
Through deep research I stumbled upon the event ‘afterContextChanged’. I’m not sure what exactly “Context” means, but it seems to be something like what I’m looking for, although it seems to fire twice for every of the above actions. But as I don’t know what “Context” means exactly, I’m not sure if this event would fire at an unexpected time. E.g. changing a context could theoretically also mean opening the preferences or something like that.
Is this the correct event for a change of activeDocument, or is there a better one available?
Extra question: Is there a list of all events available for each internal object (like Application or Document etc.). The documentation points to a “list of available events” but this cannot be all events available, and isn’t providing context (Application, Document, etc.).