Copy link to clipboard
Copied
Some questions for the UXP developers about presetting the plugin.
Let's assume that the plugin should build a separate submenu on the main InDesign menu at the start. This is an unconditional action that is executed in every session of the plugin.
The idea is to execute a certain "command" only once at the beginning of a session without user involvement, i.e. programmatically.
The regular menu is more manageable than the list of commands in the plugin panel: items can be disabled depending on the state of the active document, which is not provided in the plugin command panel.
When the plugin exits, a similar automatic command should be executed to destroy unnecessary menu items created by the plugin, etc.
Copy link to clipboard
Copied
Read about entrypoints.
Specifically, you need entrypoints.plugin.create and entrypoints.plugin.destroy.
From there it works the same way as in ExtendScript.
To work around the currently missing "$ID/" translation, you can pass objects from ExtendScript.
let scriptPanelMenu = app.doScript('app.menus.item("$ID/ScriptPanelPopup")',ScriptLanguage.JAVASCRIPT);
Copy link to clipboard
Copied
Thank you, I'm getting distracted... Yes, it really works!
Copy link to clipboard
Copied
I am doing that with a plugin currently in development actually. It is possible. However, cleaning up the menu when quitting InDesign has been a challenge. Here’s a helpful note.
Copy link to clipboard
Copied
It is also advisable to clean the menu immediately before building it. Sometimes the InDesign session crashes and the menu remains. A double cleanse will make it permanent.