Copy link to clipboard
Copied
Hi,
I would like to add a process when the "Print Book" button is pressed on the Book panel.
Is it possible to intercept the button on the built-in panel by adding an Observer?
If you have a specific example of how to do this, could you please share it with me?
Also, I couldn't find the Boss name of the Book panel and the WidgetID of the "Print Book" button in "BookID.h".
Is there any documentation in the SDK where I can find this information?
Any help would be appreciated.
Thanks,
Many widget IDs are not published in ID.h files, e.g. kPrintBookButtonWidgetID .
See menu Dev Tools >> Panel Edit Mode of the debug build.
Anyway, would you want to also handle a print action via the fly-out menu, plus e.g. scripted print? Then forget about those widgets.
Along Lawrence' suggestions:
The command kBookPrintActionCmdBoss notifies on the subject of kBookBoss (so no doc observer), protocol IID_IBOOKOUTPUTACTIONCMDDATA. But that's pretty close to when the command is already done.
Remem
...Copy link to clipboard
Copied
You would not want to deal with panel but rather with the command that is issued when Print Book happens.
You can watch the commands that are sent in the Debug build of InDesign by choosing the menu "Test > Diagnostic > Commands > Trace All Commands > On". You'll need to turn on "Test > TRACE > Command Log" if memory serves, and you'll need to open the Debug Window app from the SDK directory under "devtools".
Once all that's set up, you should be able to figure out the command boss that's being used, and then set up a document observer to catch it and respond to it or attempt to cancel it if you need to.
This is all just scratching the surface. You'll need to look in the documentation at command observers for more detail, and you'll also need to look at the difference between lazy and non-lazy updates.
You can also create a command interceptor, which is less desirable because it has a performance impact, since it affects all InDesign commands, and also opens the door to bugs in other functionality - you need to test it thoroughly. But it allows you to intercept and cancel any command.
Lawrence
Copy link to clipboard
Copied
Thanks, Lawrence
I will refer to the command observers documentation.
Copy link to clipboard
Copied
Many widget IDs are not published in ID.h files, e.g. kPrintBookButtonWidgetID .
See menu Dev Tools >> Panel Edit Mode of the debug build.
Anyway, would you want to also handle a print action via the fly-out menu, plus e.g. scripted print? Then forget about those widgets.
Along Lawrence' suggestions:
The command kBookPrintActionCmdBoss notifies on the subject of kBookBoss (so no doc observer), protocol IID_IBOOKOUTPUTACTIONCMDDATA. But that's pretty close to when the command is already done.
Remember there are also services, far earlier, e.g. kPrintDataHelperStrategyService (to interfere with Print UI) and kPrintSetupService (more likely to be relevant, see IPrintSetupProvider) …
Dirk
Copy link to clipboard
Copied
Thanks, Dirk
I was able to intercept the "Print Book" menu using an ActionFilter with an ActionID, but I couldn't do the same for the "Print Book" button, which has been problematic.
Ideally, I want to add a process before the print dialog appears.
I will look into kPrintDataHelperStrategyService and kPrintSetupService.
Is a debug version of InDesign necessary to investigate command and widget IDs? Is it impossible to verify them with the release version of InDesign and a release build of the plugin?
I am using InDesign 2024 and Visual Studio 2022.
Sorry for my lack of knowledge.
Copy link to clipboard
Copied
I was able to intercept the process using IPrintSetupProvider.
Thank you, everyone.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now