Skip to main content
Inspiring
September 5, 2014
Answered

Communicate between html extension and c++ plugin

  • September 5, 2014
  • 1 reply
  • 2062 views

Hi All,

I am developing a html extension for InDesign CC2014. There is a scenario where I need to communicate between the extension and C++ InDesign plugin.

I followed the instructions at http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/cs-extension-builder/pdfs/CC_Extension_SDK.pdf and wrote the extension part of the code. The c++ part of the code hasn't changed from the Flex versions so had no problem there.

I tried to invoke the extension from the plugin and it worked. I registered an event in the plugin to listen for and dispatched another event from the plugin. But the panel doesn't seem to listen or dispatch any event. On the c++ plugin part, the registration and dispatch error codes returned were success codes so the problem is not with the plugin.

Here is the code for the html panel,

I register the event to listen for at the time of page load.

function onLoaded() {

    var csInterface = new CSInterface();

// Register the named event handler

  csInterface.addEventListener("com.mypluginevent.test", myEventHandler);

}

//Create a named event handler callback function

function myEventHandler(event)

{

  alert("Event captured!");

}

// This function is called on a button click

function onClick()

{

  // Create your local CSInterface instance

  var csInterface = new CSInterface();

  var event = new CSEvent("com.myhtmlevent.test", "APPLICATION");

  event.data = "This is a test!";

  csInterface.dispatchEvent(event);

}

Here is the C++ part of the code where I dispatch the "com.mypluginevent.test" event.

csxs::event::Event event = {"com.mypluginevent.test",

                              csxs::event::kEventScopeApplication,

                              "myEventHandler",

                              NULL,

                              NULL};

csxs::event::EventErrorCode err = sdkPlugPlugInstance.DispatchEvent(&event);

I always get success on dispatching the event, yet the extension does not catch it.

Can anyone tell what I am doing wrong?

    This topic has been closed for replies.
    Correct answer Hallgrimur Bjornsson

    Hi,

    I'm not sure if it will help but take a look at the CC 2014 documentation (rather than the CC 2013 docs you are using): Offical Adobe Extension SDK Documentation for CC 2014<http://adobe.ly/1rin38t>

    Best regards,

    Hallgrimur

    --

    Hallgrimur Bjornsson | Adobe CCE Product Manager | @HallgrimurTh

    1 reply

    Hallgrimur Bjornsson
    Hallgrimur BjornssonCorrect answer
    Inspiring
    September 5, 2014

    Hi,

    I'm not sure if it will help but take a look at the CC 2014 documentation (rather than the CC 2013 docs you are using): Offical Adobe Extension SDK Documentation for CC 2014<http://adobe.ly/1rin38t>

    Best regards,

    Hallgrimur

    --

    Hallgrimur Bjornsson | Adobe CCE Product Manager | @HallgrimurTh

    Participating Frequently
    March 11, 2018

    Hi

    I have a HTML5 extension and filter plugin for Adobe Photoshop. I tried to communicate between C++ plugin and HTML5 using events but I am not able to do so. Please guide.

    Participating Frequently
    March 18, 2018

    Please guide me on this. This is really urgent!

    Thanks in advance.