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

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

Enthusiast ,
Mar 26, 2017 Mar 26, 2017

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

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.

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

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

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

Hi, please try

#includepath "/Volumes/work/_Resources/_Apps/adobe_scripts/"; 
#include "delete_layers.jsx";
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
Guide ,
Mar 27, 2017 Mar 27, 2017
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,

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