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

Is there a way to include a variable in an #include path?

Enthusiast ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

Below is my example that doesn't work. I have a lot of on local machine files for Illustrator, to have them appear in a menu, and I'm wondering if I am able to use a variable with #include since the path can be long. Is this possible?

scriptingPath = "/Volumes/work/_Resources/_Apps/adobe_scripts/";

#include scriptingPath + "delete_layers.jsx";

TOPICS
Scripting

Views

580

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
Guide ,
Mar 26, 2017 Mar 26, 2017

Copy link to clipboard

Copied

have you tried removing the space at the start of the variables string?

i would expect that to work.

so i would be looking at syntax.

could it be something like.

scPath = new Folder ("path goes here");

only on phone so can check now. will look when back at pc.

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
Valorous Hero ,
Mar 27, 2017 Mar 27, 2017

Copy link to clipboard

Copied

Instead of using #include, you can use eval(File()) , or $.evalFile(File()) to bring in some code.

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
Enthusiast ,
Mar 27, 2017 Mar 27, 2017

Copy link to clipboard

Copied

Hi, please try

#includepath "/Volumes/work/_Resources/_Apps/adobe_scripts/"; 
#include "delete_layers.jsx";

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
Guide ,
Mar 27, 2017 Mar 27, 2017

Copy link to clipboard

Copied

LATEST

I realise now after seeing the correct solution from moluapple​ that the "#" is not true Javascript.

So for some reason does not pass javascript variables.

Like thread here from a few years back:[JS CS3] Making the #includepath work

thanks moluapple,

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