10

I'm a JavaScript developer, who has just begun to dive into Adobe's ExtendScript technology, aiming to improve productivity and workflow on many of my enterprise's daily tasks on Illustrator PDF form generation.

In first instance I thought it was an implementation of some ECMAScript standards with addition of a propertary implementation of a Document Object Model, an API for accessing the file system and some other stuff. I was hoping the last version of the Creative Suite (CS6) implemented ECMAScript 5.

My first surprise was not finding any reference on the internet about the implementation details of the ExtendScript engine. My second surprise was finding, when querying Array.prototype for some ECMAScript 5 methods, that it is undefined, which makes me doubt of the standards-compliance of the implementation.

Can anyone provide any reference on that implementation details, if it complies any ECMAScript standard and which version?

Lots of thanks in advance.

Áxel Costas Pena
  • 5,886
  • 6
  • 28
  • 59

2 Answers2

11

If you look at the After Effects CS6 Scripting Guide, it says:

The After Effects scripting engine supports the 3rd Edition of the ECMA-262 Standard, including its notational and lexical conventions, types, objects, expres- sions, and statements. ExtendScript also implements the E4X ECMA-357 specification, which defines access to data in XML format.

I imagine the rest of the Adobe Collection is the same.

Áxel Costas Pena
  • 5,886
  • 6
  • 28
  • 59
Matthew Chung
  • 1,322
  • 1
  • 19
  • 31
  • Cool @Matthew Chung! Couldn't find this on the Scripting Guides for the other products. I've even found vague references to partial support for EX4 implementation details. Seems fair to say that ES3 is the official guaranteed to work - f*** it, because I've already found several implementation bugs which makes it non ES3 compatible, though xD – Áxel Costas Pena Mar 21 '14 at 23:58
  • Don't forget to file a formal request with Adobe so that we can script all the way into the 21st century. – brennanyoung Feb 08 '19 at 14:58
5

You can add the ECMAScript 5 array methods to ExtendScript by including a modified version of this polyfill. The one modification you need to make is at the very end of array.generics.js, remove the block of code scoped by if (document). (around line 583).

J. Peterson
  • 1,996
  • 1
  • 24
  • 21
  • 1
    @j-peterson useful tip! But it's not an answer to the question so you should add it as comment not answer – Áxel Costas Pena Mar 18 '15 at 13:50
  • I use the es5-shim.js polyfill to get forEach, isArray etc. Make a 'lib' folder, put the shim in, then add this at the top of your script somewhere: `var scriptsFolder = (new File($.fileName)).parent;$.evalFile(scriptsFolder + "/lib/es5-shim.js");` – brennanyoung Feb 08 '19 at 15:12