Hot Door CORE Forum
The notifier doesn't trigger the action - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Bugs (http://hotdoorcore.com/forum/forumdisplay.php?fid=5)
+--- Thread: The notifier doesn't trigger the action (/showthread.php?tid=339)



The notifier doesn't trigger the action - illia.budarov - 02-23-2023

Hi

I would like to program some actions when the user clicks the Export button in the File menu and after do the export.

Here the code in plugin startup function:

Code:
hdi::core::Notifier preNotifier(hdi::core::ExportCommandPreNotifierType, HDI_CORE_CALLBACK(class, &obj, func));
__corePlug->dispatcher()->registerNotifier(preNotifier);

hdi::core::Notifier postNotifier(hdi::core::ExportCommandPostNotifierType, HDI_CORE_CALLBACK(class, &obj, func));
__corePlug->dispatcher()->registerNotifier(postNotifier);


However breakpoint doesn't hit the callback function after actions.
For example, notifiers with the types 'NewCommandPreNotifierType' & ''NewCommandPostNotifierType' work well.

Could you help please?
Thanks, Illia


RE: The notifier doesn't trigger the action - Rick Johnson - 03-04-2023

Hi, Illia, I'm just another user, but have been using notifiers for quite a while. Is the code you showed exactly as it appears in your plugin? If your plugin's main class were named "exporter" and you had a callback function defined as void preExportFunc() then your code should look something like this.

Code:
hdi::core::Notifier preNotifier(hdi::core::ExportCommandPreNotifierType,
  HDI_CORE_CALLBACK(exporter::Plugin, this, preExportFunc));

__corePlug->dispatcher()->registerNotifier(preNotifier);

-- Rick


RE: The notifier doesn't trigger the action - illia.budarov - 03-07-2023

(03-04-2023, 12:16 PM)Rick Johnson Wrote: Hi, Illia, I'm just another user, but have been using notifiers for quite a while. Is the code you showed exactly as it appears in your plugin? If your plugin's main class were named "exporter" and you had a callback function defined as void preExportFunc() then your code should look something like this.

Code:
hdi::core::Notifier preNotifier(hdi::core::ExportCommandPreNotifierType,
  HDI_CORE_CALLBACK(exporter::Plugin, this, preExportFunc));

__corePlug->dispatcher()->registerNotifier(preNotifier);

-- Rick

Hi, Rick. Thanks for reply. 

I tried many options for passing arguments to the callback of the notifier constructor. I also tried your option, it didn't work either. And as I mentioned above, with other types of notifier the callback works fine.

Please tell me, does the callback with export type work for you?

Thanks, Illia


RE: The notifier doesn't trigger the action - Rick Johnson - 03-18-2023

I tried setting up that callback and then doing all three File > Export options. None of them triggered the callback. Maybe ExportCommandPreNotifierType is for something other than these menu items. I'm sorry this didn't work.

If you download the AI SDK, you can find documentation on the various notifiers here:

Adobe Illustrator 2023 SDK/docs/references/sdkdocs/index.html

There are none there related to export, so I wonder if that could be a CORE-only notifier, or if the SDK docs are just out of date. After all, those docs still reference Adobe Dialog Manager, which has been missing since Illustrator 16.


RE: The notifier doesn't trigger the action - garrett - 03-22-2023

As Rick mentioned, looking at the SDK will show a macro called kAIExportCommandPreNotifierStr, which is what hdi_core uses under the hood for hdi::core:: ExportCommandPreNotifierType.

If the callback is not firing, then it's possible kAIExportCommandPreNotifierStr refers to some other menu item or that it's broken in the SDK / Illustrator itself. We don't use this notifier ourselves so I cannot comment on its reliability.

If you really want to dig down to find this stuff out you'll have to compile a sample project in the real AI SDK and try using the kAIExportCommandPreNotifierStr notifier manually.