Custom Menus and Dialogs


Lua scripts can be integrated with EasyCatalog to provide custom menus and dialog boxes. User Interface is provided by the the InDesign Scripting DOM, which offers dialog creation and control. Details on how to access this from Lua are here.

Creating a Custom Menu Option

Adding a custom menu option is a case of creating a .lua file in the “Menus” sub folder of “Scripts” folder of a datasource. These are processed when a data source is opened. A MENU object is exposed and used to create a custom menus.  The script is maintained in a persistent state. When working with documents it’s important to not hold onto them, otherwise a protective shutdown will occur when the document is closed.

Forcing garbage collection:


Example to Inspect the Selected Records in the Data Panel. A selection object is passed to the script:

Allow the user a choice of options. The Lua state is initialised once per session, allowing choices to be maintained:

Updating Named Fields in the Data Source

Executing Javascript

External Scripts can be executing by accessing the InDesign scripting DOM via Lua. For example: