7 Replies Latest reply on Aug 5, 2011 12:29 AM by Willam van Weelden

    RoboHelp Scripting a Merged Project?

    ddng911

      Hello,

      I am trying to wrtie an ExtendScript with a merged project. I am trying to look through both topics the master project as well as the child topics. I was wondering if it was even possible? I've tried RoboHelp.openProject("C:/Adobe RoboHelp/Source/test.xpj", null) but it doesn't open the project the way I want it to. I need to give the script access to both projects at once. Essentially I am doing this:

       

      for every topic A in master project

           for every topic B in child project

                if B mentions A

                     display a link to B in A

       

      I've already done this with server-side scripting but need to convert it to a completely static format.

        • 1. Re: RoboHelp Scripting a Merged Project?
          Willam van Weelden Adobe Community Professional & MVP

          Hi,

           

          I don't think you can open two RoboHelp projects at the same time in the same script.

           

          A solution can be to first open project A and push all topics/topic paths/etc from the project in an array. Then close project A and open project B. You can then cycle project B and use the array to check whether the topic from project B points to project A.

           

          You have succeeded with server side scripting and those scripts have no access to the RoboHelp project, unless you manually read the RoboHelp project files. You can do the same with ExtendScript. For instance, I have a couple of PHP scripts that read the project XPJ file. The XPJ is an XML file.You can also read that with ExtendScript. You can thus load the project info by parsing the RoboHelp control files (xpj, fpj, apj, etc).

           

          Greet,

           

          Willam

          1 person found this helpful
          • 2. Re: RoboHelp Scripting a Merged Project?
            ddng911 Level 1

            Thanks i'll try it out but a quick question: how can i implement Javascript DOM into extendscript?

            Suppose I have a topicpath stored in path. How can I make it so I can use functions like document.getElementbyID('test')?

             

            Basically, I'm trying use Javascript functions to look up/add/remove elements by tag, id, etc.Or rather is there a way to simply add/remove elements by ID with extendscript? Suppose I have an elemtn <div id="div1">blah blah blah</div>, does extendscript have a simply function that would load the whole div1 as an object where I could modify its child, nodes, etc?

            • 3. Re: RoboHelp Scripting a Merged Project?
              Willam van Weelden Adobe Community Professional & MVP

              Hi,

               

              I can only tell you what I found out. I hope Praful can confirm/correct me.

               

              ExtendScript differs from 'regular' JavaScript in that you access an application, ie RoboHelp. There is a specific Object Model for RoboHelp and this is different from the DOM you use on web pages. This means that you cannot use DOM methods as getElementById on files. There are other methods to read and modify files/topics.

               

              With RoboHelp you can parse topics (XML and HTML files) with the TokenManager. This breaks up the HTML file into tokens and you can use that to modify files. You can also check for attributes of tags. Take a look at my article

              Getting started with ExtendScript in RoboHelp. That explains the basics of the TokenManager.

               

              You can use the TokenManager to go through your files and amend them where needed. You must beware that the TokenManager does not return an entire element with all it's children. For deleting entire tags, I created the method balancedDelete(). See

              http://www.wvanweelden.eu/robohelp/scripts/balanceddelete. That may help you create your own functions. The default RoboHelp script UDV converter is a good example of you the RH devs cycle and modify the contents of topics.

               

              So much for the RoboHelp methods. To modify files, you can also load your topic as an XML object by using the XML class. You can then use Xpath and get children and descendants. It's  powerful, but I haven't used the XML object much yet. Also, it most likely won't work on output files because of all the added JavaScript and the like.

               

              Greet,

               

              Willam

              1 person found this helpful
              • 4. Re: RoboHelp Scripting a Merged Project?
                Praful_Jain Level 3

                hi,

                DOM functionality is provided by the browser in which the javascript engine runs. RoboHelp does not support DOM methods in Scripting support as of now.

                You can achieve all the DOM methods using the TokenManager class.

                 

                thanks
                Praful

                • 5. Re: RoboHelp Scripting a Merged Project?
                  Willam van Weelden Adobe Community Professional & MVP

                  Hi Praful,

                   

                  Can you clarify that for me? 'Browser' DOM methods are not supported in RoboHelp for now. Does that mean that:

                   

                  You can achieve all the DOM methods using the TokenManager class.

                   

                  means that you can use the TokenManager to get all the elements, but in a way different than in browsers? Or do you mean that you can use regular DOM methods in the TokenManager class? (Which I can't seem to do on either the TokenManager or tokens.)

                   

                  Thanks for answering so quickly.

                   

                  Greet,

                   

                  Willam

                  • 6. Re: RoboHelp Scripting a Merged Project?
                    Praful_Jain Level 3

                    Hi,

                    TokenManager exposes very basic methods to access different tags in any HTML file. you can build high level methods using these basic methods.

                    DOM methods will not work in RoboHelp scripting model.

                    thanks

                    Praful

                    • 7. Re: RoboHelp Scripting a Merged Project?
                      Willam van Weelden Adobe Community Professional & MVP

                      Hi,

                       

                      I exepected that, but it's good to be sure. Thank you Praful.

                       

                      Greet,

                       

                      Willam