Copy link to clipboard
Copied
I have a JS script that selects layers and another one that moves items to a named layer.
var aDoc = app.activeDocument;
var layerName1 = 'Background';
aDoc.activeLayer = aDoc.layers.getByName(layerName1);
I want to be able to define all the Layer Names in another file and reference it into the above file and its ilk.
But I have tried to reference the file but I get errors.
The idea is to apply a shortcut to each scripts and program it to my keyboard.
Any help on this?
You can include one script in other script using
#include "sample.jsx"
sample.jsx - will be complete path of your script.
Let us know if you need more help.
Copy link to clipboard
Copied
You can include one script in other script using
#include "sample.jsx"
sample.jsx - will be complete path of your script.
Let us know if you need more help.
Copy link to clipboard
Copied
I have always used the extension .jsxinc in the include e.g #inlcude layers.jsxinc. I am assuming based of this it is not a requirement?
Copy link to clipboard
Copied
Also note, if you are using Visual Studio Code and ExtendScript Debugger, you need "//@include", eg.
//@include "../lib/otherFile.js"
I don't think it matters which extension you use. I've not had trouble with .js and .jsx anyway. Using .jsxinc just seemed unnecessary so I gave it up.
Mark