Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[JS][CS3] Script Librarys

Participant ,
Jul 22, 2009 Jul 22, 2009

Hi.

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.

Cheers

Roy

TOPICS
Scripting
847
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 22, 2009 Jul 22, 2009

Hi, Roy!

Check the following file of the InDesign CS3 SDK:

javascript_tools_guide_cs3.pdf

p216 "Modular Programming Support"

Excerpt:

"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
script."

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

ar42s03s03.html

"Loading external scripts"

Excerpts:

"ExtendScript has an #include feature you ca

...
Translate
Community Expert ,
Jul 22, 2009 Jul 22, 2009

Hi, Roy!

Check the following file of the InDesign CS3 SDK:

javascript_tools_guide_cs3.pdf

p216 "Modular Programming Support"

Excerpt:

"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
script."

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

ar42s03s03.html

"Loading external scripts"

Excerpts:

"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()"

Greetings,

Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 23, 2009 Jul 23, 2009
LATEST

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,

Roy

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines