• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

What version of JavaScript supported?

Engaged ,
Jun 19, 2019 Jun 19, 2019

Copy link to clipboard

Copied

Hello,

I was just curious what version of JS does ESTK support for Adobe Illustrator?

I am noticing that “const” works, but “let” does not.

Is there a list somewhere of supported language features?

Thanks!

TOPICS
Scripting

Views

5.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Jun 20, 2019 Jun 20, 2019

ExtendScript based ECMA Edition 3 and not support "let" and "const" is better not to use it.

You can refer below.

Use of 'const' in ExtendScript

Votes

Translate

Translate
Enthusiast , Mar 02, 2023 Mar 02, 2023

Likely a copy/paste error on my part, apologies. Check here to reference

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

ExtendScript based ECMA Edition 3 and not support "let" and "const" is better not to use it.

You can refer below.

Use of 'const' in ExtendScript

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

Awesome, thanks Ten, I really appreciate the help!

Also, thanks for the linkage ... That's very helpful.

Looks like I'll stick to es3 and be happy with it.

Thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

Hey there! It's been a while, look who's back!

Also, ExtendScript has 'extras' such as - it supports triple quotes which act almost like template strings, except no normal syntax highlighter for javascript would recognize them, as well as xml inside of javascript!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

Hi Silly-V,

I saw a photo in the Twitter timeline that your session in the Dev Events.

I wanted to see it in the front row but I couldn't go because of to far from here. (^-^;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

They should help you out and bring you across vast oceans!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

Fly me to the... (^-^;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 20, 2019 Jun 20, 2019

Copy link to clipboard

Copied

Silly-V  wrote

Hey there! It's been a while, look who's back!

Also, ExtendScript has 'extras' such as - it supports triple quotes which act almost like template strings, except no normal syntax highlighter for javascript would recognize them, as well as xml inside of javascript!

Hey Silly-V​! It's great to hear from you!

Yah, I've been afk from doing Illustrator scripting for (I think) a few years now (how time flies!)

I've recently gotten back into Illustrator more again, and got inspired to write some jsx.

My last project was a Nodejs module (several of them) and it's spoiled me to the ways of ES2018+ ...

Anyway, I'm happy to be back in the game. I do love Illustrator the most out of all the Adobe products.

Thanks for the tips on the triple quotes! That's pretty interesting. Also, I will have to play with the XML syntax. I'm looking forward to dusting off my brain cells and creating some new plugins!

I'll see you around the forums!

Thanks to both of you Ten A​ and Silly-V​, I really appreciate your help!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Well, nowadays you should be aware: future ExtendScript development after dropped support for ESTK will be done via a VSCode ExtendScript Debugger extension. (At 062019 version 1.1.1)

It's a little more cumbersome than the toolkit, and lack an OMV without some extra TypeScript stuff the pros (like you) use   but when working on a Mac or a newer version of Windows that doesn't support old ESTK, it's alright.

There's also the issue of funky debugging - where the thing just aborts instead of stopping at a breakpoint - unless you step into.. etc - I've just been too busy and grateful for it working as well as it does.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Silly-V  wrote

Well, nowadays you should be aware: future ExtendScript development after dropped support for ESTK will be done via a VSCode ExtendScript Debugger extension. (At 062019 version 1.1.1)

It's a little more cumbersome than the toolkit, and lack an OMV without some extra TypeScript stuff the pros (like you) use   but when working on a Mac or a newer version of Windows that doesn't support old ESTK, it's alright.

There's also the issue of funky debugging - where the thing just aborts instead of stopping at a breakpoint - unless you step into.. etc - I've just been too busy and grateful for it working as well as it does.

Oh, wow! Ok, I am really out of the loop.

In a way, I'm kinda relieved that I can just use VSCode ... My current workflow involves having VSCode open and then jumping over to ESTK to hit compile and/or do breakpoints/view the OMV. I would much prefer to stay in an editor that's easier on my aging eyeballs.

Thanks so much for the heads up! I just installed the plugin and I am looking forward to playing with it this weekend.

Oh, Silly-V, did I read above that you presented at a conference? Googling ...

Events

Looks cool!!! Did you get a recording of it?

Happy Friday!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Yea, I had my kids record it on an iPad, but it's a bumbling wreck of a presentation - like 100% of all my presentations - maybe in 5 years I'll get better at them

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 21, 2019 Jun 21, 2019

Copy link to clipboard

Copied

Awwww!

Well, if you do ever put it up, shoot me a link!

I feel you on bumbling. I've only had to do one thing like that, and i sucked! Hehe. Though, I'm sure your presentation went better than you are thinking ... Aren't we all our own worst critics.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 23, 2019 Jun 23, 2019

Copy link to clipboard

Copied

Do you know about pravdomil's types? It's what Silly V is referring to, writing in Typescript can compile down to allow quite a bit of ES2018 (with exception to certain array functions like forEach/filter and template literals):

FarBlackAiredale-size_restricted.gif

I have the correct tsconfig file here if you're interested! Just npm install @pravdomil/types-for-adobe (or types-for-adobe), then assuming you use VSCode hit Control+Shift+B and run the tsc:watch command on this tsconfig file. Write all your scripts in the .ts file, but point to the .jsx for use in CEP. It auto-compiles to .jsx every time you save and gives you DOM autocomplete! Pretty slick

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 24, 2019 Jun 24, 2019

Copy link to clipboard

Copied

Actually, come to think of it, you can add support for ES6 Array methods in .jsx! I've just confirmed with filter like below:

  
    // Preload this into .jsx using $eval prior to your .ts file being loaded

   Array.prototype.filter = function(param) {

     var filtered = [];

     for (var i = 0; i < this.length; i++)

       if (param(this, i, this)) filtered.push(this);

     return filtered;

   };


   // Now in your .ts file you can use:

   let filtered = ["a", "b", "c", "d"].filter(item => {

     return /a|d/.test(item);

   });

   alert(filtered);

I'll make a utility library myself because I too am completely spoiled by ES6 Array methods nowadays. I'll share once it's done.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

Inventsable  wrote

Do you know about pravdomil's types? It's what Silly V is referring to, writing in Typescript can compile down to allow quite a bit of ES2018 (with exception to certain array functions like forEach/filter and template literals):

FarBlackAiredale-size_restricted.gif

I have the correct tsconfig file here if you're interested! Just npm install @pravdomil/types-for-adobe (or types-for-adobe), then assuming you use VSCode hit Control+Shift+B and run the tsc:watch command on this tsconfig file. Write all your scripts in the .ts file, but point to the .jsx for use in CEP. It auto-compiles to .jsx every time you save and gives you DOM autocomplete! Pretty slick

Oh, shoot, that's cool!!!

Thanks for sharing!!!

I've been super busy this last week+ with some life BS ... Sorry to not have responded sooner.

This looks really cool though! THanks so much for sharing/elaborating. I can't wait to use it!

I'm sure I'll be back here, on in a new thread, with more questions.

Thanks @Inventsable! I really appreciate the help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

Hey,
as far as i know, pravdomil types are no longer maintained.

They are not updated to newset versions of adobe applications, and updating it by the pravdomils generator for types doesn't work out of box.

Even though it's pretty helpful. I'm just wondering if Adobe is on the road with creating some language server for ExtendScript, or we will need to stick to the pravdomil types.

If anyone have corrected file with types for illustrator i'd be happy to see it. I've found it few days ago and i'm thinking if should i use it even though there are some errors.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2019 Jul 01, 2019

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 26, 2019 Jun 26, 2019

Copy link to clipboard

Copied

Was told by Remco Janssen that this already exists somewhere, but regardless here's filter, map, find, and forEach:

  // Support for filter()

  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

  //

  Array.prototype.filter = function(callback) {

   var filtered = [];

   for (var i = 0; i < this.length; i++)

     if (callback(this, i, this)) filtered.push(this);

   return filtered;

  };


  // Support for find()

  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find

  //

  Array.prototype.find = function(callback) {

   var filtered = [];

   for (var i = 0; i < this.length; i++)

     if (callback(this, i, this)) return this;

  };


  // Support for map()

  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map

  //

  Array.prototype.map = function(callback) {

   var mappedParam = [];

   for (var i = 0; i < this.length; i++)

     mappedParam.push(callback(this, i, this));

   return mappedParam;

  };


  // Support for forEach()

  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach

  //

  Array.prototype.forEach = function(callback) {

    for (var i = 0; i < this.length; i++) callback(this, i, this);

  };

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

@Inventsable 

Wondering why these prototypes dont seem to work properly with cc 2018. I tried that Array prototype and it returns the complete list added 4 times with this example. Unless i dont change a small part in the function, it wont work correct

 

// Inventsable
// https://community.adobe.com/t5/illustrator-discussions/what-version-of-javascript-supported/m-p/10488213#M136748
Array.prototype.forEach = function(callback) {
    for (var i = 0; i < this.length; i++) callback(this[i], i, this);
};


var sum = 0;
var numbers = [65, 44, 12, 4];
numbers.forEach(myFunction);
function myFunction(item) {
  sum += item;
}
alert(sum)

Noticed that in the callback(this,i, this) i made a change to callback(this[i], i, this). Otherwise it return the complete array each time its called?! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

Likely a copy/paste error on my part, apologies. Check here to reference

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 06, 2023 Mar 06, 2023

Copy link to clipboard

Copied

LATEST

Thanks for the link!
PS i see many useful tools on your github, nice 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 02, 2019 Jul 02, 2019

Copy link to clipboard

Copied

Thanks !

Gonna check it out

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines