Skip to main content
peter.nicolai.sf
Participant
February 12, 2020
Answered

How to find Javascript version in Photoshop 21.0.3?

  • February 12, 2020
  • 3 replies
  • 2521 views

I'm trying to debug some javascripting we are doing to help out art pipeline.

 

I'm using a startsWith() method that seems to work fine in a stand alone js test script run within VS Code, but the exact same lines seem to fail or error silently when called within Photoshop (a call to the script handled by the Script Event Manager). Running PS 21.0.3 20200115.r.91.

 

One of the working theories is that PS may have a different version of JS it ships with that accounts for different behavior.  If anyone can help me track down the JS version to help prove/disprove the theory, that would be grand.

{Thread renamed by moderator} 🙂

This topic has been closed for replies.
Correct answer Kukurykus

2 months ago 20 years passed and we still use ECMAScript 3 (1999)

3 replies

Legend
February 12, 2020

$.about() shows the Extendscript About box

Kukurykus
KukurykusCorrect answer
Legend
February 12, 2020

2 months ago 20 years passed and we still use ECMAScript 3 (1999)

peter.nicolai.sf
Participant
February 12, 2020

Ahhh. That might explain it.

 

From what I can gather on-line startsWith() was introduced in or around ECMA6 and was still not supported by all browsers in 2009. If the Javascript PS supports pre-dates that by even further (an addt'l 10 yrs?!) then it is likley not supported.

 

pete 

Kukurykus
Legend
February 12, 2020

You could implement:

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}

 

if not the fact first you had to implement defineProperty, and then other prototypes like call etc

Sahil.Chawla
Adobe Employee
Adobe Employee
February 12, 2020

Hi Peter,

Not sure how to check the supported Javascript version in Photoshop, however, you may have a look at this article and see if it helps: https://www.adobe.com/devnet/photoshop/scripting.html

Regards,
Sahil

peter.nicolai.sf
Participant
February 12, 2020

Hey,

 

thanks for the link. I've already been looking at those docs and unfortuantley can't find any ref to supported JavaScript versions.

 

Pete