10 Replies Latest reply on Mar 27, 2012 12:43 PM by pipurs

    Anyone used a Microsoft DLL using the ExternalObject object?

    partswiz Level 1

      There are a number of DLL libraries in Windows that are commonly used by jaavascipt and vbscript programmers:

      ActiveX Data Objects, Excel API library, Word API library, XML, SOAP library, Scritping Runtime.

       

      Anyone know of a way to access these from the ESTK?

        • 1. Re: Anyone used a Microsoft DLL using the ExternalObject object?
          John Hawkinson Level 5

          Isn't this the same as your other thread?

           

          Anyhow, sorry, no. InDesign's JavaScript implemenation is self-contained and doesn't give you access to these kinds of extensions. It is really just pure javascript, plus the InDesign DOM, E4X, and a few Adobe extensions, like their Http and Socket libraries.

          • 2. Re: Anyone used a Microsoft DLL using the ExternalObject object?
            Marc Autret Level 4

            Anyway it is correct that ExtendScript offers an ExternalObject object which allows to load a DLL into JavaScript —direct-access style for C-language libraries and indirect-access style for C++ libraries. Is this feature Bridge specific, I don't know... For more details see "Integrating External Libraries" in the JavaScript Tools Guide.

             

            @+

            Marc

            • 3. Re: Anyone used a Microsoft DLL using the ExternalObject object?
              John Hawkinson Level 5

              Marc is of course correct, you can also add your own DLLs to ExtendScript.

              Sorry for not mentioning that!

              It's certainly more available than just Bridge, you can extend

              InDesign too.

              I believe the API is Adobe-specific, though, and you're not going to

              be able to load other DLLs...

               

              (On the other hand, I suppose you could write a wrapper DLL to

              address this...)

               

              More practically, unless performance is an issue, it's probably easier

              to call VB from JavaScript.

               

              I have the impression this API is a bit more sketchy than you would

              like to believe -- for instance, the "webaccesslib" library (providing

              FtpConnetion and HttpConnection) only works in Bridge. I did try

              moving the file around and then loading it in InDesign, and failed.

              Perhaps I just wasn't creative enough, but it seemed weirdly fragile -- why

              would it not work in InDesign but would work in Bridge?

              • 4. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                John Hawkinson Level 5

                I wrote:

                I have the impression this API is a bit more sketchy than you would

                like to believe -- for instance, the "webaccesslib" library (providing

                FtpConnetion and HttpConnection) only works in Bridge. I did try

                moving the file around and then loading it in InDesign, and failed.

                Perhaps I just wasn't creative enough, but it seemed weirdly fragile -- why

                would it not work in InDesign but would work in Bridge?

                So, I hadn't really looked at it for CS5 when I wrote this, and now I'm even more confused.

                In CS5, the documentation of webaccesslib is moved out of the Javascript Tools Guide and into the Bridge Javascript Reference (not Guide), so if you don't read that you'd never know. Maybe ESClientInterface() is returning an error that's not kESErrOK when it's not called from Bridge?

                 

                I guess I should actually poke around inside it...unless anyone knows?

                • 5. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                  zyberkid Level 1

                  Samples available here.

                   

                  we have used it, its working great..

                  <adobe instalation drive/folder>\Adobe\Adobe Utilities\ExtendScript Toolkit CS4\SDK\Samples\cpp\build\basicexternalobject\win

                  • 6. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                    John Hawkinson Level 5

                    zyberkid: A little more context would be good.

                    Are you saying you've used 3rd party DLLs in ExendScript directly, without writing wrappers? That would be good to see an example of.

                     

                    Or are you saying that you've been able to build your own DLLs following the ExtendScript API as documented in the Bridge SDK? That is unremarkable and already noted above in the thread...

                    • 7. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                      zyberkid Level 1

                      yes, i have tried to load a .net Dll and tried calling a method, and it worked,

                      these are the steps,

                       

                      first you should look for the correct .net framework installed in the machine.

                      load the framework,

                      then load the library,/ namespace.

                      allocate application domain space for running.

                      then create instance for that library(external microsoft dll)

                      then call the method,

                       

                      i would probably post the sample code..

                      • 8. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                        Olav Kvern Level 1

                        Hi partswiz,

                         

                        Is there some reason you want to use the JavaScript/ExtendScript external object with a DLL? Given that you mention VBScript, why not just use VBScript? If you do that, you can use the libraries as you'd use any other libraries from VBScript--lots of examples are around (the samples that get installed with InDesign use the FileSystemObject, for example).

                         

                        Thanks,

                         

                        Ole

                        • 9. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                          moniuch

                          Hi,

                           

                          I bumped into this thread while searching for an answer on integrating ESTK with RealStudio (an external commercial IDE). While my problem does not belong to Microsoft DLL any way, and not necessarily to InDesign forum in particular, I would certainly like to get in touch with people who managed to integrate ESTK with outer world.

                           

                          Has any of you used any external IDE as an UI tool, send/receive data to/from ESTK and trigger scripts externally?

                           

                          Please feel free to move this discussion to another more appropriate forum. BTW think we could have a general forum for ExtendScript as an environment.

                           

                          Regards,

                          moniuch

                          • 10. Re: Anyone used a Microsoft DLL using the ExternalObject object?
                            pipurs

                            Been fiddling trying to accomplish what you wrote but I lack enough understanding - is it possible for you to explain the steps just a little bit more?

                             

                            Regards

                            /peter