6 Replies Latest reply on Feb 26, 2009 11:24 PM by Lion J

    I want to communication with c++ sdk plug-ins by javaScript

    Lion J
      When I created c++ indesign plug-ins, I used dollyx.

      so, I create indesign server c++ sdk plus-ins by dollyx.

      of couse, I choice InDesignServer.

      and default sayHello() created successfully.

      and startup the indesignserver, I founded that plug-ins count increased.

      But, My javaScript could not connect app.sayHello() function.

      what is the problem?

      Thank you.
        • 1. Re: I want to communication with c++ sdk plug-ins by javaScript
          Lion J Level 1
          It's dollyx bug.

          you have to modify your resoure file like below.
          dolly miss the "kInDesignServerAllLanguagesFS" .

          resource VersionedScriptElementInfo(2)
          {
          // Contexts
          {
          // Scripting support added at InDesign CS 2.0
          kFiredrakeScriptVersion, kCoreScriptManagerBoss, kInDesignAllLanguagesFS, k_Wild,
          kFiredrakeScriptVersion, kCoreScriptManagerBoss, kInCopyAllLanguagesFS, k_Wild,
          kFiredrakeScriptVersion, kCoreScriptManagerBoss, kInDesignServerAllLanguagesFS, k_Wild,
          }

          Have a good time..
          • 2. Re: I want to communication with c++ sdk plug-ins by javaScript
            Hello,

            This post was useful for me as I also developed a server plugin using Dollyxs. Then I modified my resoure file as suggested above.

            Javascript file named "sayhello.js" is there which i run in a hope that plugin works.

            Does, this js file should contain "app.sayhello()" ??? Or what is the way through which I can make this plugin do its job while running the sayhello.js file.

            Reading this post, I tried putting "app.sayhello()" in the sayhello.js file, but got an error as "app.sayhello is not a function".

            Kindly help...
            • 3. Re: I want to communication with c++ sdk plug-ins by javaScript
              Level 1
              Also, please guide me in this issue.
              My plugin (generated through Dollyxs) has an event "speak" as registered in the code.

              does this mean that sayhello.js file should have "app.speak" which will be handled by the HandleEvent function of *ScriptProvider.cpp?

              Also, speak function is not supported by Indesign server. So I tried registering another event in the code, so that calling that event in sayhello.js may be handled in plugin code.

              Please help in clarifying the procedure.
              • 4. Re: I want to communication with c++ sdk plug-ins by javaScript
                Lion J Level 1
                In sayHello.js
                ///

                var said = "Hello";
                app.consoleout("said = "+ said);

                app.speak(said);

                //
                in ScriptProvider.cpp
                //
                ErrorCode Speak(
                ISciptEventData * data, IScript* parant)
                {
                ErrorCode status = kFailure;

                ScriptDara scriptData;
                status = data->ExtractEventData(p_Said, scriptData);

                if (status == kSuccess) {
                PMString data;
                status = scriptData.GetPMString(data);
                }
                return status;
                }

                you can get "Hello" in the varariable data.
                Have a good luck
                • 5. Re: I want to communication with c++ sdk plug-ins by javaScript
                  Level 1
                  Hello byung-wan Jung,

                  Thanks a lot for reply.The code snippets you have written above, is exactly what is written in my two files. But this code runs fine, when plugin is put into desktop Indesign application. Same code of lines don't work with server plugin(of same functionality) as 'speak' method is not recognized by the Indesign server.

                  In sayhello.js when we put 'app.speak(said); ', then server throws an error saying that speak is not function.

                  So I am looking, what should be done so that code runs fine in server as well.
                  • 6. Re: I want to communication with c++ sdk plug-ins by javaScript
                    Lion J Level 1
                    Hello tjtj,

                    InDesign Server code same to InDesign Desktop code.
                    So, I think you have some problem in your code.

                    If you have created the source code from the dolly then
                    InDesign server not work.

                    You can find that problems and solutions .

                    Thank you.