4 Replies Latest reply on Aug 10, 2009 11:10 AM by dkhicks7

    js external library

    dkhicks7 Level 1

      Hi, I'm trying to create an external library of javascript functions for all of the InDesign functions that are repeated in my scripts. I've seen many examples on how to do this for a webpage, and I've tried using src = filename, but I'm not having much luck. Is there a special way to do this in ExtendScript? Thanks!

        • 1. Re: js external library
          Bob Stucky Adobe Employee

          There is an #include directive; however, I've always found that somewhat fragile in the real world. If you're working on a single-file script, most just add the library code to each script.

           

          That said, how large it the project? Does it involve using a persistent scripting engine and stuff like menus? If so, take a look at my web site, www.creativescripting.net. In the Free Stuff section there's an InDesign project template that includes a script that loads a project from a set of files dynamically. I also included an extension to the ESTK that does a batch conversion to jsxbin if you need to convert it prior to release.

          • 2. Re: js external library
            dkhicks7 Level 1

            The project actually isn't that large at all, 20 or so scripts. In fact, all the functions that I would be putting in the library already exist in the individual scripts as it is. My boss insists that I should put my functions in a library like he does for foxpro. It would be easier for editing the scripts later on I guess, but do you think it's worth it?

            • 3. Re: js external library
              Bob Stucky Adobe Employee

              I wouldn't do it. (and I've been coding in ExtendScript for Adobe apps since 2001).

               

               

               

              Bob

              • 4. Re: js external library
                dkhicks7 Level 1

                Great, I'll pass that along. Thanks for the help. Nice website also!