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

javascript include?

New Here ,
Feb 17, 2009 Feb 17, 2009

Copy link to clipboard

Copied

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

Views

18.0K

Translate

Translate

Report

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

Copy link to clipboard

Copied

>
> 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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

> 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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

thank you Sir, exactly what I was looking for. Cheers!

Votes

Translate

Translate

Report

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