9 Replies Latest reply on Aug 14, 2013 3:11 AM by František Erben

    Is it possible to use the javascript document object model in eclipse?

    d.stoeck

      Hi community,

       

      does anybody know if it is possible to integrate the Adobe document object model (the basic core classes, the scripting ui classes, the classes for indesign, photoshop, acrobat, ...) into Eclipse? It would be the heaven on earth to have all the class dependencies, all the attributes and methods right at and within eclipse.

       

      I know Java and JavaScript are two different worlds, but let me give u an example so that u can easier understand what I am talking about: When I integrate an external library into any project in eclipse then I also add the source and the JavaDoc. The result is that Eclipse now knows all classes, all methods, attributes and so on. For example when I create an object of any class of that external library eclipse already knows all it's possible attributes and methods.

       

      I got around 85 Adobe JavaScript projects within Eclipse and this would be soooooo useful. I am dreaming of some kind of jsx(bin) file(s) from Adobe that can be imported into eclipse projects and thus eclipse knows all the Adobe classes...

       

      Am I just dreaming or is that possible?

       

      Regards,

      Daniel

        • 1. Re: Is it possible to use the javascript document object model in eclipse?
          Trevorׅ Adobe Community Professional

          I'm pretty sure this can be done.

           

          maybe http://forums.adobe.com/message/5054999#5054999 might put a little light on the topic (talks about perl there) but I gather the objects can be passed to whatever you want.

          I seem to remember Bob Stuckey passing to Java (could be way off there) do a search on it or send him a PM.

          • 2. Re: Is it possible to use the javascript document object model in eclipse?
            d.stoeck Level 1

            I dont want to send objects to any other programming or scripting language. All I want is having the Adobe document object model within eclipse to know all classes, attributes, methods while programming inside eclipse.

             

            I think... I THINK if I had a .jsx file containing the complete description of all classes and stuff I could just include it as external library... but such a file does not exist.

             

            Nobody writing Adobe scripts within eclipse at a higher level?

            • 4. Re: Is it possible to use the javascript document object model in eclipse?
              František Erben

              If I understood correctly, so you want write ExtendScript in Eclipse instead of ExtendScrript toolkit and you want to get contextual autocomplete function (help system).

              Bad news - AFAIK I didn't find anything which can replace ExtendScript toolkit.

              ExtensScript Toolkit is really crap for middle-size and big-size projects at least because I autocomplete function does not work acros files attached with #include function.

               

              For big-size projects is better main program write in any other multiplatform language (Ruby/Python…) and from that languages launch small ExtedScript scripts which comunicate with Adobe apps.

              • 5. Re: Is it possible to use the javascript document object model in eclipse?
                [Jongware] Most Valuable Participant

                An excellent idea, Vamitul! With the help of XSLT, Adobe's omv*.xml files -- the files that contain the ExtendScript Help text -- can be transformed into whatever format is handy.

                 

                A couple of notes:

                 

                1. I was going to tell where to look for the files but I found it's bloody impossible to locate the originals on my computer. "Search files" just doesn't see them, or they are hidden well, or they reside in some impossible-to-search folder or subsystem.

                 

                By the way #1, the usual filename is "omv$indesign-7.0$7.0.xml", where "OMV" = "Object Model View" (I think), "InDesign" is the name of the program, the first "7.0" is the target version (7.0 is InDesign CS5), and the second "7.0" is the source version (ID comes with dictionaries for older versions as well, typically you'd only need the one for your current version.)

                 

                By the way #2: from memory -- I don't think the above is true for all programs in the CS "suite".

                 

                2. I collected data for InDesign, InCopy, Photoshop, Illustrator and Framemaker, as well as for Extendscript's Core Classes and ScruiptUI. I can't remember if Acrobat has a Help file in the same format or not -- I've never seen it, nor searched for it.

                 

                3. You cannot simply copy-and-paste all of the XML data into a single large file. For one, the XML data format does not allow this -- you would have to create a new XML structure. For two, lots of classes share the same name over the different programs -- "Window", for example, is something else in InDesign than it is in ScriptUI. I manually concatenated the Core and ScriptUI classes with ID's, and that alone was troublesome enough because of all the duplicates. There are cross-references inside as well, and you have to resolve these.

                 

                4. Just to give you a hint on the amount of data: ID CS4's XML file is 135,436 lines long, contains 469 classes, 305 enumerations, and just short of 5,000 methods. It took me several tries to initially get the same information as is shown in the OMV Help viewer (but after that I could improve on it ).

                 

                5. Converting the OMV into something else is a great exercise in XSLT programming: you're going to need all the tricks you can find. Not in the least because there are a number of minor coding errors in it -- dead links, typos, strangely converted UTF-8 characters ... the lot.

                • 6. Re: Is it possible to use the javascript document object model in eclipse?
                  d.stoeck Level 1

                  I found out that you can include "user libraries" for the complete development environment or for particular projects in Eclipse. These "user libraries" are just *.jsx files that contain the class descriptions including all attributes and methods. Though I don't know if these original .jsx files do exist anywhere (from Adobe?).

                   

                  So basically: If there were .jsx files for all the different parts such as Photoshop, Indesign, Core, ScriptUI, ... then everyone could use Eclipse including contextual auto-complete. For me (as I am not a professional programmer, but working everyday with Adobe Scripts) this would be heaven. Having all the classes, methods, attributes within milliseconds instead of searching the API or the ESTK object model viewer for the particular method I am loking for.

                  • 7. Re: Is it possible to use the javascript document object model in eclipse?
                    Vamitul Level 4

                    i can mostly live without autocomplete (sometimes it actualy annoys me), yet i would still love to use a better tool than ESTK. Even better, i would love the chance to hook up Visual Studio, and use TypeScript (http://www.typescriptlang.org) for scripting InDesign, but that means finding a way to use a different debugger than ESTK, and i don't think that is possible (please someone tell me i'm wrong)

                    • 8. Re: Is it possible to use the javascript document object model in eclipse?
                      [Jongware] Most Valuable Participant

                      d.stoeck wrote:

                       

                      I found out that you can include "user libraries" for the complete development environment or for particular projects in Eclipse. These "user libraries" are just *.jsx files that contain the class descriptions including all attributes and methods. Though I don't know if these original .jsx files do exist anywhere (from Adobe?).

                       

                      No, Adobe only supplies the raw XML data files. If you need another format, you have to transform them yourself -- as I did, from XML to HTML. I guess the Eclipse data files are JSON -- not a "difficult" format to create, but I am unfamiliar with the expected format and don't have the time to find out.

                       

                      I do all my programming in TextPad (Windows) and TextWrangler (Mac), and don't mind the occasional switch to a CHM viewer to look up something in detail.

                       

                      By the way: after an exhausting in-depth search, my computer finally found "C:\Program Files (x86)\Common Files\Adobe\Scripting Dictionaries CS4". That contains the data for Bridge, Illustrator, Photoshop, and "Common files" (ScriptUI and ESTK classes), but not for InDesign

                      • 9. Re: Is it possible to use the javascript document object model in eclipse?
                        František Erben Level 1

                        Run ExtendScript fom Eclipse:

                        http://www.pearltrees.com/#/N-f=1_6208032&N-fa=6208004&N-p=57856299&N-play=2&N-s=1_6208032 &N-u=1_820306

                         

                        String[] commands = new String[]{"cmd", "/c", "start \"\" photoshop c:\\Users\\MyUserName\\Desktop\\new.jsx"}; try { Runtime.getRuntime().exec(commands); } catch (IOException e) { e.printStackTrace(); }