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

How to find Javascript version in Photoshop 21.0.3?

Community Beginner ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

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} 🙂

TOPICS
Actions and scripting , Windows

Views

1.5K

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 1 Correct answer

LEGEND , Feb 12, 2020 Feb 12, 2020

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

Votes

Translate

Translate
Adobe
Adobe Employee ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

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

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 Beginner ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

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

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
LEGEND ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

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

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 Beginner ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

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 

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
LEGEND ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

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

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 Beginner ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

Thanks for the code snippet. I've quickly got a windowed workflow running with search() method right now since startsWith() was a non-starter. I'll look this over and see if I can use it. Appreciate the help!

 

cheers,

Pete

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
LEGEND ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

LATEST

$.about() shows the Extendscript About box

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