[JS] #include does not work
Hi guys,
i'm an Applescript guy trying to translate an AS script in JS.
So far, it's working with one pb though: i want to use the array.filter method in my script but it doesn't work.
I've replaced it via a simple loop and it work, but as it seems it could be done via the use of a polyfill, i tried that too, without success.
I guess i have done something wrong somewhere and i hoped someone here could help me find it!
What i've done so far:
- copy the polyfill for that method from this page on MDN,
- creating a new file on ExtendScript*, paste the code, save the file ("polyfills.jsx"**) in the same folder as my script.
- added at the beginning of my script "#include 'polyfills.jsx';"
* I don't know if it's relevant, but the selected engine when saving the file was "Adobe InDesign CC2017 (12.064)", the same used by my script.
** I couldn't use the .jsxinc extension as when i do that, it create a "polyfills.jsxinc.jsx" file.
When i launch my script in ExtendScript Toolkit, it throws an error on the line where i use the filter method : 'xxx.filter is not a function'.
So the polyfill doesn't seem to work.
The code where i use the filter method:
var my_textFrames = doc.textFrames;
var my_filtered_textFrames = my_textFrames.filter(function (element) {
return (element.label.indexOf('tableau') !== -1);
});
Thank for your help!
config:
OS X 10.11.6
InDesign CC 2017 12.0.0.81
ExtendScript Toolkit 4.0.0.1
