Skip to main content
matias.kiviniemi
Legend
June 16, 2015
Question

Photoshop CC 2015 changes to scripting

  • June 16, 2015
  • 18 replies
  • 15470 views

It's again the time of year that Adobe releases a new version with some new "features" so I was thinking we should share issues to minimize time on debugger

  • Greatly improved Javascript performance, I'd say at least 2-3x improvement in my scripts, Kudos Adobe
  • Dialogs are much more responsive and change updates immediatelly. However in my end loop (waiting for user to click OK) dialog became unresponsive and hanged Photoshop. Needed to add app.refresh() in the loop (but don't use in script as it has great performance impact).

So far looking looking good, but please share if you discover some changes

This topic has been closed for replies.

18 replies

JJMack
Community Expert
Community Expert
March 12, 2018

I feel the list would be long most would not know that the list existed and if Adobe did a good job fixing bugs  users like Paul would not have left here.

JJMack
Kukurykus
Legend
March 12, 2018

Over two and a half year elapsed. Now we have CC 2018 (19.1.1). Were any of these (reported or not) bugs fixed? Can users posting here that time say their problems were solved? That would be best if Adobe with each release would officially add to new product features all scripting bugs they are aware of but not going (at least in closest future) to do anything with

Is there any list of all known scripting bugs that can be found in range of same page? It would be great seeing on such site (in table-like shape) next to each bug informations like when it was produced and the status of progress, like fixed (with a date), related links or something like reason it won't be 'never' fixed. I can't imagine anything better. It would be useful!

JJMack
Community Expert
Community Expert
March 12, 2018

Many of the bugs introduce back then have been fixed not all and new bugs have been added. You can user search one Adobe Feedback site to see reported bugs to see which have been fixed. Photoshop Family Customer Community

JJMack
Kukurykus
Legend
March 12, 2018

Lately I visit this site much, but it's not handy to browse all topics, it takes a lot of time, and is not readable. Friendly table / list with all reported bugs would make life easier, and encourage users to be part of reporting preocess. Imagine you open www.adobe.com/bugs/photoshop/scripting page and you have all at single glance. When bugs were introduced, reported, how many users met it and can't deal with, votes to see is certain bug cumbersome, Ps versions it exist, when fixed, priority it got from Adobe, link to description and images of wrong behaviour etc. So basicly readable information on the one page with possibility to click an item on list / table for more details, and if clicking related link be taken to dedicated discussion.

Participant
July 31, 2015

I have discovered the following problems in Script UI:

1. No more trigger on events like onClick() with "image" elements

#target photoshop 

 

dlg = new Window("dialog"

dlg.orientation = 'column'

dlg.alignChildren = 'fill' 

dlg.alignment = 'fill' 

 

var myImg = dlg.add("image"); 

myImg.image = File('photo.png'

myImg.onClick = function(){alert('Click')}//and nothing happens... 

 

dlg.show() 

2. .location properties for elements like "iconbutton" (and another) always return undefined. And there is no way to control this properties

,

3. The groups is not transparent. I think this way is wrong. Because restricts the possibility of creating interfaces.

Functionality of my script UI has been built on it. And now this is broken. (

DBarranca
Legend
July 31, 2015

Risking to repeat myself and being annoying to the rest of the world: please go to the PS feedback site and report them as bugs if somebody didn't do that already.

It is really important that we keep ourselves heard.

Thank you,

-Davide

DBarranca
Legend
July 19, 2015

Another funny (...) one.

EditText fields don't get updated if they're multiline (this drives me crazy)

var winRes = "dialog { \

  orientation: 'column', alignChildren: 'fill', preferredSize: [200,200], \

  info1: StaticText { text: 'Change the value in the EditText and press OK'}\

    info2: StaticText { text: 'In PS CC2015 / OSX the value is NOT updated :-('}\

    info23: StaticText { text: 'this happens when { multiline: true }'}\

  input: EditText { text: 'pippo', properties: { multiline: true }, }, \

  okBtn: Button { text: 'OK', properties:{ name:'ok' } }, \

  cancelBtn: Button { text:'Cancel', properties: { name: 'cancel' } } \

}";

var w = new Window(winRes);

w.okBtn.onClick = function() {

  alert("The Value in the EditText field is:\n" + w.input.text);

}

w.show();

Type whatever you want into the field, it returns the default value:

I'm more and more disheartened.

-Davide

Damon D Bell
Known Participant
July 14, 2015

Just curious, has anyone heard anything from Adobe on if/when there may be a new release with bug fixes for the strange dialog issues that everyone is experiencing?

My Photoshop version shows as 2015.0.0 20150529.r.88 2015/05/29.  The Creative Cloud update shows nothing available.  Is 5/29 really the last updated version or is my Creative Cloud updater not working properly?  This seems like a long time between updates for a new release so I thought I'd check to make sure that r.88 is really the last release.

Inspiring
July 15, 2015

You have the most recent rev. No word on when the next rev is going to be released or what will be fixed.

DBarranca
Legend
July 11, 2015

There is another (reported) issue halfway between scripting and HTML Panels.

In Photoshop you can't apparently use #include statements in the JSX of an HTML Panel - it won't work (InDesign for instance is different).

To load multiple JSX files at runtime, you are forced to:

- pass from the JS to the JSX the Extension's root path: csInterface.getSystemPath(SystemPath.EXTENSION)

- in the JSX use the path to $.evalFile()

So far so good, apparently (even if it's not clear who has access to the ExtendScript context first, the main script or the extra ones loaded at document.ready), but the problem is that functions declared in the extra JSX don't stick to the ExtendScript context - that is, if you call them they're undefined - even if the $.evalFile() files are parsed correctly (e.g. if you put alerts in there, they fire).

As a result, to my experience it's not possible to successfully modularize JSX files.

See a demo extension here: https://dl.dropboxusercontent.com/u/23243188/com.example.evalJSX.zip

Davide

Known Participant
September 28, 2015

DBarranca wrote:

There is another (reported) issue halfway between scripting and HTML Panels.

In Photoshop you can't apparently use #include statements in the JSX of an HTML Panel - it won't work (InDesign for instance is different).

To load multiple JSX files at runtime, you are forced to:

- pass from the JS to the JSX the Extension's root path: csInterface.getSystemPath(SystemPath.EXTENSION)

- in the JSX use the path to $.evalFile()

So far so good, apparently (even if it's not clear who has access to the ExtendScript context first, the main script or the extra ones loaded at document.ready), but the problem is that functions declared in the extra JSX don't stick to the ExtendScript context - that is, if you call them they're undefined - even if the $.evalFile() files are parsed correctly (e.g. if you put alerts in there, they fire).

As a result, to my experience it's not possible to successfully modularize JSX files.

See a demo extension here: https://dl.dropboxusercontent.com/u/23243188/com.example.evalJSX.zip

Davide

This caused a half-day of head ache and anguish.

Directly running .jsx I can:

#include "./js/libs/json2.js"

calling from a panel through CSInterface, here's what I have to add at the top of any .jsx file that I need to have an include in (eg. a JSON.stringify() command from external lib) *it's not elegant, but it's what I ended up with*:

function IncludeHack( sysPath, subPath )

{

    try

    {

        $.evalFile( sysPath + subPath )

    }

    catch ( err )

    {

        return err.message + " : $.evalFile(" + sysPath + subPath + ")"

    }

    finally

    {

        return ""

    }

}

function MyFunc( sysPath )

{

    var includeErr = IncludeHack( sysPath, '/js/libs/json2.js' )

    if ( includeErr.length )

    {

        return includeErr

    }

    else

    {

        return JSON.stringify( {'joolee':'Do the thing!'} )

    }

}

then call from my main.js panel script:

csInterface.evalScript( 'MyFunc("'+csInterface.getSystemPath(SystemPath.EXTENSION)+'")', function ( result ){console.log(result)})

DBarranca
Legend
September 28, 2015

Hi Max,

you've given me sort of a hint about the reason why your example works and my doesn't. The answer is: the way the JSON object is constructed.

If you look at the json2.js sourcecode, it says:

if (typeof JSON !== 'object') {  

    JSON = {};

}

Please note that it doesn't say "var JSON =", so it becomes a Global.

In fact, any code that I put in a secondary JSX fails if it is like:

// FAILS

var secondJSXFunction = function() {

  alert("Hello world from anotherFile.jsx");

}

// FAILS too

function secondJSXFunction() {

  alert("Hello world from anotherFile.jsx");

}

While it works if it's:

secondJSXFunction = function() {

  alert("Hello world from anotherFile.jsx");

}

Not-so-slight difference, since secondJSXFunction becomes a global var. (which I do NOT like).

(update: actually both version, with and without var, will create a global, since they already are in the global scope and not inside a function - it's possibly better to group everything inside a - global - object literal)

I've opened an issue here: [Photoshop] Functions in secondary, correctly parsed JSX fail to execute · Issue #27 · Adobe-CEP/CEP-Resources · GitHub feel free to vote/contribute.

Davide

ymmtny
Participant
July 4, 2015

addEventListener to static text stopped working in CC 2015

----------------------------------------------

var win = new Window("dialog", "Test Window"); 

win.g = win.add("Group{ orientation: 'row', alignment:'right',  cb: Button {text:'Cancel'}, pb: StaticText {text:'Create'}}");

win.g.pb.addEventListener ("click", function(e){

    alert("test")

    });

JJMack
Community Expert
Community Expert
July 4, 2015

Please report the problem  on Adobe feedback site Photoshop Family Customer Community

JJMack
Rei_Martins
Inspiring
June 29, 2015
Chuck Uebele
Community Expert
Community Expert
June 29, 2015

Is this what you're looking for:

Adobe Photoshop SDK | Adobe Developer Connection

JJMack
Community Expert
Community Expert
June 29, 2015

The link take you to a page that has ad download like for CC 2015 SCK wihich take tou to an agreement page tha has tah actual doload links for Windows and Mac  both get a html 404 not found error

Adobe Photoshop CC 2015 SDK

JJMack
gimblll
Participant
June 29, 2015

Listbox columns seem to be broken when going from 2014 -> 2015, at least for me:

Posted a thread here: Listbox columns not working in Photoshop CC 2015

Opened an issue/ticket here: Photoshop CC 2015: Listbox columns do not work anymore

Participating Frequently
July 1, 2015

regarding the list bug: Listbox columns seem to be broken when going from 2014 -> 2015, at least for me

Any news on this or how should I develop the UI differently ?

Thx you to flag it, I was looking why I can't display the column correctly, except to have the "anuj" result.

Do you know what anuj mean ?

Cheers

gimblll
Participant
July 1, 2015

I found no workaround for it, sorry. The listbox columns just don't seem to work in 2015, so I use 2014 for now.

Chuck Uebele
Community Expert
Community Expert
June 25, 2015

Seems to be a bug with dialogs not closing if a second dialog is opened.

How to close parent window immediately at Photoshop CC2015?