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

javascript include?

New Here ,
Feb 17, 2009 Feb 17, 2009
Hi,

is there a way to include another script file into the current script (and then call a function from the other script)? e.g. to build a pure "library" file with lots of functions that can then be used by various other scripts.

Is that possible?
If tried things like include(path/to/file.jsx), but that didn't work.
Couldn't find much clue in the scripting docs...

Any idea?
TOPICS
Actions and scripting
18.4K
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
Adobe
Explorer ,
Feb 17, 2009 Feb 17, 2009
>
> is there a way to include another script file into the current script (and then call a function from the other script)? e.g. to build a pure "library" file with lots of functions that can then be used by various other scripts.
>

//@include "xlib/stdlib.js"

or

#include "xlib/stdlib.js"


The first is needed for backwards compatibility with CS (which I have to worry
about) and maybe CS2.

This is documented in the JS Tools Guide in the ESTK chapter.

-X
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
New Here ,
Feb 17, 2009 Feb 17, 2009
Thanks a lot...very helpful!
Unfortunately, it seems that when I include one other JS file, I'm loosing the standard Photoshop objects (a scripts that was running fine before now doesn't). Do I have to add another line that declares that I want to include Photoshop's standard functions or something like that?
I'm a bit confused...
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
Explorer ,
Feb 17, 2009 Feb 17, 2009
> Do I have to add another line that declares that I want to include Photoshop's standard functions or something like that?

If you are running it from within ESTK, make sure that you have
#target photoshop

as your first line.

-X
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 ,
Sep 18, 2018 Sep 18, 2018
LATEST

What if I'm not running from ESTK? If I'm trying to build external libraries that I include in my scripts that are run from a panel, how do I make references to Photoshop's objects then?

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
New Here ,
Feb 18, 2009 Feb 18, 2009
thank you Sir, exactly what I was looking for. Cheers!
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