I have illustrator scripts that select Layers and other scripts that move items to named layers.
I want to create one file where I can name all the layers as variables, I have some experience with PHP and I understand the include function. I need something similar that will work with JS.
I have tried the code from this link - jQuery.getScript
But I am getting errors, so it seems I am missing something (I don't have any experience with JS). I'm not even sure if Illustrator works like that.
This is the code
var aDoc = app.activeDocument;
$.getScript( "LayerNames.js" )
.done(function( script, textStatus ) {
console.log( textStatus );
})
.fail(function( jqxhr, settings, exception ) {
$( "div.log" ).text( "Triggered ajaxError handler." );
});
aDoc.activeLayer = aDoc.layers.getByName(layerName1);
LayerNames.js has the following code
var layerName1 = 'Background';
The error I get is $.getScript
is not a function.
So, the question is, can I reference an external js file in an illustrator script and if yes, how?