2 Replies Latest reply on Jul 23, 2009 4:29 AM by Roy Marshall

    [JS][CS3] Script Librarys

    Roy Marshall Level 1



      I am going to be embarking on a large scripting project soon, and would like to know if there is any way I can point a script to a different script file containing my commonly used functions.  This is something similar to (as my failing memory recalls) in c++, having the #include........ line at the top of the code.


      If this can be done, great, but if not, I can live with using simple functions in the one main script.





        • 1. Re: [JS][CS3] Script Librarys
          Laubender Adobe Community Professional & MVP

          Hi, Roy!

          Check the following file of the InDesign CS3 SDK:



          p216 "Modular Programming Support"


          "ExtendScript provides support for a modular approach to scripting by allowing you to include one script in
          another as a resource, and allowing a script to export definitions that can be imported and used in another


          also see the following file of the InDesign CS4(!) SDK:



          "Loading external scripts"


          "ExtendScript has an #include feature you can use to include an external JavaScript file, so the functions in the include file are available for the locale script to use; however, you cannot use it to load a compiled binary script. If you want to distribute your JavaScript feature in binary format like Export as XHTML, you cannot use #include to load an external JavaScript file."


          "In CS3, Export as XHTML’s source has a function called loadScript()"





          • 2. Re: [JS][CS3] Script Librarys
            Roy Marshall Level 1

            Hi Uwe.


            Thanks for that solution.


            That was really easy!!!! and I will use this feature to keep my common code in one place.


            Thanks again matey,