• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Event names for paragraph and character styles

Explorer ,
Apr 20, 2019 Apr 20, 2019

Copy link to clipboard

Copied

you can supposedly add events to p/c Styles. Is there a list of those styles available?

(Or some way to generate a list of all ID events?)

Thanks

TOPICS
Scripting

Views

735

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

It looks like the functions addEventListener and removeEventlistener and the properties events and eventsListener are always added to each InDesign object, so they exist at the highest possible level of the DOM and trickle down into everything.

If you check grefel's reference, under Document (https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Document.html ), for example, you can find a separate section "Constants/Events", which lists the events that can captured. But none of the items under the Text object have this.

Here is a quick XSLT that lists all objects that have something in their events. I cannot quite remember how to discern events from regular properties, but it seems they all are classes and all have a string property. ("Regular" objects can have string properties as well but these are instances, not classes.)

<?xml version="1.1" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" >
<xsl:output method="text"/>

<xsl:template match="/">
<xsl:for-each select="/dictionary[1]//classdef[elements[@type='class'][property/datatype/type='string']]">
  <xsl:sort select="./@name" />
  <xsl:value-of select="./@name" /><xsl:text>&#xa;</xsl:text>
  <xsl:apply-templates select="elements[@type='class'][property/datatype/type='string']" /><xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</xsl:template>

<xsl:template match="elements">
<xsl:for-each select="property[datatype/type='string']">
  <xsl:sort select="./@name" />
  <xsl:value-of select="./@name" /><xsl:text>&#9;</xsl:text><xsl:value-of select="./shortdesc" />
  <xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

Run against the latest omv$indesign-*.xml (that of CC2019; and again took me far too long to finally locate it!), you'd get something like this:

Application
AFTER_ACTIVATE Dispatched after the Application becomes active. This event bubbles. This event is not cancelable.
AFTER_CLOSE Dispatched after a Document is closed. This event bubbles. This event is not cancelable.
AFTER_CONTEXT_CHANGED Dispatched after the active context changes. This event bubbles. This event is not cancelable.
... 300 lines omitted, see next message ...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

After re-reading, I think listing Event and related *Event objects is useless and best could be left out of the list: their properties are merely copies of more useful events from the actual live object. They must be some kind of "virtual" objects, merely containers for the proper event objects.

That would then be Event itself and its derived classes PrintEvent, IdleEvent, MutationEvent, DocumentEvent, and ImportExportEvent. Updated XSLT:

<?xml version="1.1" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" >
<xsl:output method="text"/>

<xsl:template match="/">
<xsl:for-each select="/dictionary[1]//classdef[not(@name='Event' or superclass[@href='#/Event'])][elements[@type='class'][property/datatype/type='string']]">
  <xsl:sort select="./@name" />
  <xsl:value-of select="./@name" /><xsl:text>&#xa;</xsl:text>
  <xsl:apply-templates select="elements[@type='class'][property/datatype/type='string']" /><xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</xsl:template>

<xsl:template match="elements">
<xsl:for-each select="property[datatype/type='string']">
  <xsl:sort select="./@name" />
  <xsl:value-of select="./@name" /><xsl:text>&#9;</xsl:text><xsl:value-of select="./shortdesc" />
  <xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

and the result from omv$indesign-14.064$14.0.xml:

Application
AFTER_ACTIVATE Dispatched after the Application becomes active. This event bubbles. This event is not cancelable.
AFTER_CLOSE Dispatched after a Document is closed. This event bubbles. This event is not cancelable.
AFTER_CONTEXT_CHANGED Dispatched after the active context changes. This event bubbles. This event is not cancelable.
AFTER_QUIT Dispatched when the Application is quitting. Since the quit has been committed, it can not be canceled. This event bubbles. This event is not cancelable.
AFTER_SELECTION_ATTRIBUTE_CHANGED Dispatched after an attribute on the active selection changes. This event bubbles. This event is not cancelable.
AFTER_SELECTION_CHANGED Dispatched after the active selection changes. This event bubbles. This event is not cancelable.
BEFORE_DEACTIVATE Dispatched before the Application becomes inactive. This event bubbles. This event is not cancelable.
BEFORE_NEW Dispatched before a Document is created. This event bubbles. This event is cancelable.
BEFORE_OPEN Dispatched before a Document is opened. This event bubbles. This event is cancelable.
BEFORE_QUIT Dispatched before the Application is quit. Allows the quit to be canceled. This event bubbles. This event is cancelable.


Button
AFTER_PLACE Dispatched after a Button is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Button is placed. This event bubbles. This event is cancelable.


CheckBox
AFTER_PLACE Dispatched after a CheckBox is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a CheckBox is placed. This event bubbles. This event is cancelable.


ComboBox
AFTER_PLACE Dispatched after a ComboBox is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a ComboBox is placed. This event bubbles. This event is cancelable.


Document
AFTER_ACTIVATE Dispatched after the Document becomes active. This event bubbles. This event is not cancelable.
AFTER_EXPORT Dispatched after a Document is exported. This event bubbles. This event is not cancelable.
AFTER_IMPORT Dispatched after importing a file into a Document. This event bubbles. This event is not cancelable.
AFTER_LINKS_CHANGED Dispatched after one or more links in the Document have been added, deleted, or modified. This event bubbles. This event is not cancelable.
AFTER_NEW Dispatched after a Document is created. This event bubbles. This event is not cancelable.
AFTER_OPEN Dispatched after a Document is opened. This event bubbles. This event is not cancelable.
AFTER_PRINT Dispatched after a Document is printed. This event bubbles. This event is not cancelable.
AFTER_REVERT Dispatched after a Document is reverted. This event bubbles. This event is not cancelable.
AFTER_SAVE Dispatched after a Document is saved. This event bubbles. This event is not cancelable.
AFTER_SAVE_AS Dispatched after a Document is saved under a new name. This event bubbles. This event is not cancelable.
AFTER_SAVE_A_COPY Dispatched after a copy of a Document is saved. This event bubbles. This event is not cancelable.
BEFORE_CLOSE Dispatched before a Document is closed. This event bubbles. This event is not cancelable.
BEFORE_DEACTIVATE Dispatched before the Document becomes inactive. This event bubbles. This event is not cancelable.
BEFORE_EXPORT Dispatched before a Document is exported. This event bubbles. This event is cancelable.
BEFORE_IMPORT Dispatched before importing a file into a Document. This event bubbles. This event is cancelable.
BEFORE_PRINT Dispatched before a Document is printed. This event bubbles. This event is cancelable.
BEFORE_REVERT Dispatched before a Document is reverted. This event bubbles. This event is cancelable.
BEFORE_SAVE Dispatched before a Document is saved. This event bubbles. This event is cancelable.
BEFORE_SAVE_AS Dispatched before a Document is saved under a new name. This event bubbles. This event is cancelable.
BEFORE_SAVE_A_COPY Dispatched before a copy of a Document is saved. This event bubbles. This event is cancelable.
FAILED_EXPORT Dispatched after a Document export is canceled or fails. This event bubbles. This event is not cancelable.


EPS
AFTER_PLACE Dispatched after a EPS is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a EPS is placed. This event bubbles. This event is cancelable.


EPSText
AFTER_PLACE Dispatched after a EPSText is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a EPSText is placed. This event bubbles. This event is cancelable.


EndnoteTextFrame
AFTER_PLACE Dispatched after a EndnoteTextFrame is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a EndnoteTextFrame is placed. This event bubbles. This event is cancelable.


FormField
AFTER_PLACE Dispatched after a FormField is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a FormField is placed. This event bubbles. This event is cancelable.


Graphic
AFTER_PLACE Dispatched after a Graphic is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Graphic is placed. This event bubbles. This event is cancelable.


GraphicLine
AFTER_PLACE Dispatched after a GraphicLine is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a GraphicLine is placed. This event bubbles. This event is cancelable.


Group
AFTER_PLACE Dispatched after a Group is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Group is placed. This event bubbles. This event is cancelable.


Guide
AFTER_PLACE Dispatched after a Guide is placed. This event bubbles. This event is not cancelable.


HtmlItem
AFTER_PLACE Dispatched after a HtmlItem is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a HtmlItem is placed. This event bubbles. This event is cancelable.


IdleTask
ON_IDLE Dispatched at idle time for this IdleTask. This event does not bubble. This event is not cancelable.


Image
AFTER_PLACE Dispatched after a Image is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Image is placed. This event bubbles. This event is cancelable.


ImportedPage
AFTER_PLACE Dispatched after a ImportedPage is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a ImportedPage is placed. This event bubbles. This event is cancelable.


LayoutWindow
AFTER_ACTIVATE Dispatched after the LayoutWindow becomes active. This event bubbles. This event is not cancelable.
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this LayoutWindow. This event bubbles. This event is not cancelable.
AFTER_CLOSE Dispatched when a LayoutWindow is closing. Since the close has been committed, it can no longer be canceled. This event bubbles. This event is not cancelable.
AFTER_OPEN Dispatched after a LayoutWindow is opened. This event bubbles. This event is not cancelable.
AFTER_SELECTION_ATTRIBUTE_CHANGED Dispatched after an attribute on the active selection changes. This event bubbles. This event is not cancelable.
AFTER_SELECTION_CHANGED Dispatched after the active selection changes. This event bubbles. This event is not cancelable.
BEFORE_CLOSE Dispatched before a LayoutWindow is closed. This event bubbles. This event is cancelable.
BEFORE_DEACTIVATE Dispatched before the LayoutWindow becomes inactive. This event bubbles. This event is not cancelable.


Link
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this Link. This event bubbles. This event is not cancelable.
AFTER_DELETE Dispatched after a Link is deleted. This event bubbles. This event is not cancelable.
AFTER_EMBED Dispatched after a Link is embedded. This event bubbles. This event is not cancelable.
AFTER_MOVE Dispatched after a Link is relocated from one object to another. This event bubbles. This event is not cancelable.
AFTER_NEW Dispatched after a Link is created. This event bubbles. This event is not cancelable.
AFTER_UNEMBED Dispatched after a Link is unembedded. This event bubbles. This event is not cancelable.
AFTER_UPDATE Dispatched after a Link is updated. This event bubbles. This event is not cancelable.
BEFORE_DELETE Dispatched before a Link is deleted. This event bubbles. This event is cancelable.
BEFORE_EMBED Dispatched before a Link is embedded. This event bubbles. This event is cancelable.
BEFORE_MOVE Dispatched before a Link is relocated from one object to another. This event bubbles. This event is cancelable.
BEFORE_UNEMBED Dispatched before a Link is unembedded. This event bubbles. This event is cancelable.
BEFORE_UPDATE Dispatched before a Link is updated. This event bubbles. This event is cancelable.


ListBox
AFTER_PLACE Dispatched after a ListBox is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a ListBox is placed. This event bubbles. This event is cancelable.


MediaItem
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this MediaItem. This event bubbles. This event is not cancelable.
AFTER_PLACE Dispatched after a MediaItem is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a MediaItem is placed. This event bubbles. This event is cancelable.


Menu
BEFORE_DISPLAY Dispatched before the Menu is displayed. This event does not bubble. This event is not cancelable.


MenuAction
AFTER_INVOKE Dispatched after the MenuAction is invoked. This event does not bubble. This event is not cancelable.
BEFORE_INVOKE Dispatched before the MenuAction is invoked. This event does not bubble. This event is cancelable.


Movie
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this Movie. This event bubbles. This event is not cancelable.
AFTER_PLACE Dispatched after a Movie is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Movie is placed. This event bubbles. This event is cancelable.


MultiStateObject
AFTER_PLACE Dispatched after a MultiStateObject is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a MultiStateObject is placed. This event bubbles. This event is cancelable.


Oval
AFTER_PLACE Dispatched after a Oval is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Oval is placed. This event bubbles. This event is cancelable.


PDF
AFTER_PLACE Dispatched after a PDF is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a PDF is placed. This event bubbles. This event is cancelable.


PICT
AFTER_PLACE Dispatched after a PICT is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a PICT is placed. This event bubbles. This event is cancelable.


PageItem
AFTER_PLACE Dispatched after a PageItem is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a PageItem is placed. This event bubbles. This event is cancelable.


Polygon
AFTER_PLACE Dispatched after a Polygon is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Polygon is placed. This event bubbles. This event is cancelable.


RadioButton
AFTER_PLACE Dispatched after a RadioButton is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a RadioButton is placed. This event bubbles. This event is cancelable.


Rectangle
AFTER_PLACE Dispatched after a Rectangle is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Rectangle is placed. This event bubbles. This event is cancelable.


ScriptMenuAction
AFTER_INVOKE Dispatched after the ScriptMenuAction is invoked. This event does not bubble. This event is not cancelable.
BEFORE_DISPLAY Dispatched before the ScriptMenuAction is displayed. This event does not bubble. This event is not cancelable.
BEFORE_INVOKE Dispatched before the ScriptMenuAction is invoked. This event does not bubble. This event is cancelable.
ON_INVOKE Dispatched when the ScriptMenuAction is invoked. This event does not bubble. This event is not cancelable.


SignatureField
AFTER_PLACE Dispatched after a SignatureField is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a SignatureField is placed. This event bubbles. This event is cancelable.


Snippet
BEFORE_PLACE Dispatched before a Snippet is placed. This event bubbles. This event is cancelable.


Sound
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this Sound. This event bubbles. This event is not cancelable.
AFTER_PLACE Dispatched after a Sound is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Sound is placed. This event bubbles. This event is cancelable.


SplineItem
AFTER_PLACE Dispatched after a SplineItem is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a SplineItem is placed. This event bubbles. This event is cancelable.


Story
AFTER_PLACE Dispatched after a Story is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a Story is placed. This event bubbles. This event is cancelable.


StoryWindow
AFTER_ACTIVATE Dispatched after the StoryWindow becomes active. This event bubbles. This event is not cancelable.
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this StoryWindow. This event bubbles. This event is not cancelable.
AFTER_CLOSE Dispatched when a StoryWindow is closing. Since the close has been committed, it can no longer be canceled. This event bubbles. This event is not cancelable.
AFTER_OPEN Dispatched after a StoryWindow is opened. This event bubbles. This event is not cancelable.
AFTER_SELECTION_ATTRIBUTE_CHANGED Dispatched after an attribute on the active selection changes. This event bubbles. This event is not cancelable.
AFTER_SELECTION_CHANGED Dispatched after the active selection changes. This event bubbles. This event is not cancelable.
BEFORE_CLOSE Dispatched before a StoryWindow is closed. This event bubbles. This event is cancelable.
BEFORE_DEACTIVATE Dispatched before the StoryWindow becomes inactive. This event bubbles. This event is not cancelable.


Submenu
BEFORE_DISPLAY Dispatched before the Submenu is displayed. This event does not bubble. This event is not cancelable.


TextBox
AFTER_PLACE Dispatched after a TextBox is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a TextBox is placed. This event bubbles. This event is cancelable.


TextFrame
AFTER_PLACE Dispatched after a TextFrame is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a TextFrame is placed. This event bubbles. This event is cancelable.


TextPath
AFTER_PLACE Dispatched after a TextPath is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a TextPath is placed. This event bubbles. This event is cancelable.


ToolBox
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this ToolBox. This event bubbles. This event is not cancelable.


WMF
AFTER_PLACE Dispatched after a WMF is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a WMF is placed. This event bubbles. This event is cancelable.


Window
AFTER_ACTIVATE Dispatched after the Window becomes active. This event bubbles. This event is not cancelable.
AFTER_ATTRIBUTE_CHANGED Dispatched when the value of a property changes on this Window. This event bubbles. This event is not cancelable.
AFTER_CLOSE Dispatched when a Window is closing. Since the close has been committed, it can no longer be canceled. This event bubbles. This event is not cancelable.
AFTER_OPEN Dispatched after a Window is opened. This event bubbles. This event is not cancelable.
AFTER_SELECTION_ATTRIBUTE_CHANGED Dispatched after an attribute on the active selection changes. This event bubbles. This event is not cancelable.
AFTER_SELECTION_CHANGED Dispatched after the active selection changes. This event bubbles. This event is not cancelable.
BEFORE_CLOSE Dispatched before a Window is closed. This event bubbles. This event is cancelable.
BEFORE_DEACTIVATE Dispatched before the Window becomes inactive. This event bubbles. This event is not cancelable.


XmlStory
AFTER_PLACE Dispatched after a XmlStory is placed. This event bubbles. This event is not cancelable.
BEFORE_PLACE Dispatched before a XmlStory is placed. This event bubbles. This event is cancelable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

Thanks for the list. It's incredibly helpful in general.

Is there some way to have a generic event handler that would catch ALL events received? I could add that to a paragraph style and then monitor it to see what events/messages it receives...

(Just for development of course)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 23, 2019 Apr 23, 2019

Copy link to clipboard

Copied

LATEST

As I understand it (*), if it were possible to add a wildcard event (I don't know if you could), it just would not fire for everything that is not explicitly listed above.

Check Marc Autret's article on this for more insights: Indiscripts :: How to Implement a Basic Action Listener in InDesign

(*) => "barely".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines