0

New to Basil.js, but love it dearly.

I am wondering if it is possible to link other javascript sheets in my .jsx script and what the correct procedure is. When I try:

#include "basiljs/users/anotherscript.jsx";

InDesign throws err:

Error Number: 48 Offending Text: #include "basiljs/users/anotherscript.jsx";

2 Answers2

1

yes you can normal includes :) the example below shows for instance how to include underscore.js to your basil sketch. please note the very first line with "#includepath", this line basically includes the whole document folder for mac and pc ... then you can specify from there on a relative path to the file for including.

#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";
#include "basiljs/libraries/underscore.js";

function draw() {
  var result = _.map([1, 2, 3], function(num){ return num * 3; });
  b.println( result );
}

b.go();
0

I don't think you can use include that way in extendscript.

However this WILL work:

//include another script
$.evalFile(new File("basiljs/users/anotherscript.jsx"));

If it doesn't work, try a full path to your script.

$.evalFile(new File("/c/somefolder/basiljs/users/anotherscript.jsx"));
bgmCoder
  • 6,205
  • 8
  • 58
  • 105