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

Photoshop CC 2015 changes to scripting

Enthusiast ,
Jun 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

13.2K

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
Adobe
Advisor ,
Jun 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

Notes on PS2015/JS:

- The underlying UI engine has changed which is the reason for all that is new and/or different.

- ScriptUI is very much faster. Not sure about the actual DOM side.

- Some script's UIs will break. I have some serious issues RadioButtons. [Reported]

- UI widgets have been 'adjusted' which means layout will be off a bit or a lot depending on what you are doing. Auto-layout may or may not be affected.

- Centering palette windows with multiple monitors centers relative to the bounding box of the monitors, not to the active/current monitor. [Reported]

- I have a version of Image Processor Pro in development that will crash PS after running the script and simply hitting the Cancel button.

  This appears to be happening as the window is being deconstructed. This only happens on Win7. [Reported]

- There may still be JS syntax or runtime errors that are not recognized. By this, I mean the script just terminates without an error dialog. [Reported]

Ex:

if (|| true) {

  alert('true');

}

will (occasionally) run without incident but throw an error on CC2014 and CS6.

I've filed bugs for all of these and the good people at Adobe are aware of them.

If anybody finds additional bugs, please post them in this thread and report them here: Adobe - Feature Request/Bug Report Form

Edited for clarity.

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 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

I was having issue with radio buttons too. They would not work unless they were in a group. I got a note that said that it was fixed, but haven't checked yet. the new UI size does mess up some of my scripts. Would love to have a scroll bar on the UI.

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 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

Adobe documented something in what new on that.

Photoshop Help | Photoshop UI toolkit for plug-ins and scripts

UI Layout

There are no changes in the scripting APIs for creating user interfaces. However, there is a difference in the way the grouping widget works.

In Flex, the “group” widget used to act as layout mechanism for grouping widgets and used to be completely invisible itself. Now, “group” is itself a widget with its own background and can’t overlap with other widgets.

For instance, if we have two groups arranged one over the other with widgets in each group such that widgets from one group do not overlap with widgets in the other group, all widgets are visible in Flex.

Group widget - Flex


However, in the new framework, in the same scenario, the group at the top hides the group at the bottom.

Group widget - New framework


Note:

Some users may find that their existing scripts have incorrect UI layout in the new framework because of this same reason. All such scripts should be modified by removing overlaps in the “group” widgets. Scripts created afresh in the new framework or modified to run in it work fine in Flex as well.

JJMack

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 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

Does anyone know if it's possible to change Eclipse to install for CC2015 (and not the default CC2012 32bit)? I face personal development process issue with AEM no longer working with CC2015 (CEP folder missing). I.e. normally I use the Eclipse Ctrl+F11 to update .html/.js/.jsx for quick iterations and then build a zxp when ready for more version testing. But if I'm to develop CC2015-only stuff can't use Eclipse and with no AEM I'd need to upload a test build to Add-ons.I guess there's always manual copying the stuff (any good links exactly what needs to go where)?

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 ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

Hi Matias,

you should be able to change the Eclipse preferences > Adobe Extension Builder 3 > CC Launching Paths > Service Manager

(put /Library/Application Support/Adobe/CEP/).

For Extensions, I've put together a CC2015 Survival Guide‌ that might be of some help.

Regards,

Davide

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 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

Only tested on Win 7.....

window.location doesn't work for any of my dialogs.   It centers the window regardless of the coordinates.

window.location still works on palettes though

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 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

Again, only tested on Win 7....

graphics.font = ScriptUI.newFont  isn't working.  The font will display default size and font style.

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 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

graphics.font = ScriptUI.newFont  isn't working.  The font will display default size and font style.

That's a bummer! i was thinking of using that due to the new UI size.

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 ,
Jun 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

Don't forget the new Mondo rendering engine for Scripts!!

---

(Ops, had the message window open for a long time and posted this not noticing it's been already mentioned in the thread. I'll be collecting Mondo discrepancies vs the previous ScriptUI engine and report here!)

Davide Barranca

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 ,
Jun 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

Speaking of Mondo, JPGs can't be loaded anymore in ScriptUI dialogs:

var w = new Window ("dialog", "Bouquet");

var flowers = w.add ("image", undefined, File ("~/Desktop/Fiore.jpg"));

w.show ();

Invalid Image Data error - only PNGs - hopefully this is going to be fixed.

Davide

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 16, 2015 Jun 16, 2015

Copy link to clipboard

Copied

Umm, I've always used pngs, just for the transparency.

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
Explorer ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

So far I've run into these issues:

- Photoshop CC2015 on Win7 crashes instantly when an extension runs a jsx to draw a window or palette using script UI. The same script works perfect when being run from ExtendScript instead of from the extension. Also, if I just briefly run any script that draws a script UI window (either from ExtendScript or from File->Scripts) then the extension works without any crashes... until next time PS is restarted. Vote for the support ticket here: PS CC2015 (win7) crashes instantly when extension uses script UI

- Seems there is a change in what kind of error dialogs are shown. Stdlib.convertToSmartLayer() now results in an error saying "The object 'layer 394 of document 5932' is not currently available". This is caused in Stdlib.wrapLCLayer() when it tries to reselect the layer and it's not available. It can be avoided by using app.displayDialogs = DialogModes.NO

/ Rune

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
Advisor ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

A similar problem popped up a few versions ago which was solved by adding an app.refresh() or Stdlib.waitForRedraw(). I'll add an exception handler in and put your DialogModes.NO work-around in wrapLCLayer.

I'll do a push of xtools to the CVS tree on SourceForge later this week and a full release after the dust settles on the PS/CC2015 release. I've already dropped in changes for CC2015 elsewhere in xtools that will be included in that refresh.

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
Advisor ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

I pushed my current xtools environment out to SourceForge that includes the wrapLCLayer() fix and all of my CC2015 and other mods. I'll packaged up a beta zip later in the week.

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 ,
Jun 24, 2015 Jun 24, 2015

Copy link to clipboard

Copied

Hi Rune,

I am facing the same issue of Photoshop crashing when we try to create a palette from within an extension. Did you hear back from Adobe on the fix for this issue?

Thanks.

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
Explorer ,
Jun 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

JSinha, last I heard was that the engineers would take a look at it. But you should give the support ticket a vote here: Photoshop CC 2015: (win7) Crashes instantly when extension uses script UI

I did come up with a hackish workaround to this issue though. If you make a script that briefly shows an (invisible) dialog and closes it again, and run that from Photoshop's File->Script menu before using the extension, then Photoshop will not crash. This means that you can distribute that script together with your extension and run it as part of the extension initialization, and everything will work out the box for the end user. Here's my code:

// Copy this script to Photoshop/Presets/Scripts folder

var dlgWindow = new Window("palette", "");

dlgWindow.opacity = 0;

dlgWindow.show();

dlgWindow.close();

// In your panel initialization

try{

    if ($.os.match(/windows/i)) {

        var idAdobeScriptAutomationScripts = stringIDToTypeID( "AdobeScriptAutomation Scripts" );

            var desc1 = new ActionDescriptor();

            var idjsNm = charIDToTypeID( "jsNm" );

            desc1.putString( idjsNm, """YOUR SCRIPT NAME""" );

            var idjsMs = charIDToTypeID( "jsMs" );

            desc1.putString( idjsMs, """undefined""" );

        executeAction( idAdobeScriptAutomationScripts, desc1, DialogModes.NO );

    }

}catch(e){};

Crazy, eh.

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 ,
Jun 26, 2015 Jun 26, 2015

Copy link to clipboard

Copied

Hey Rune,

Already voted for the support ticket.

Thanks much for your suggestion..will try it out. I guess we can only wait for Adobe to come up with a fix

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
Explorer ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

Window.find('xxxx').close() doesn't work on my code.

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 18, 2015 Jun 18, 2015

Copy link to clipboard

Copied

Photoshop object model disappeared from the Object Model Viewer ( OMV) for me, when installing Photoshop 2015. Is that the case for other scripters? Please open ExtendScript ToolKit CC and check for Photoshop in the list.

Also see: Photoshop missing in Object Model Viewer (ExtendScript ToolKit CC) after installing 2015 CC for a screen shot.

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
Explorer ,
Jun 23, 2015 Jun 23, 2015

Copy link to clipboard

Copied

CC2015 also seems to have broken ScriptUI.environment.keyboardState.

Reported here: Photoshop CC2015 has broken Script UI Keyboard state object

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 23, 2015 Jun 23, 2015

Copy link to clipboard

Copied

Were eventlisteners mentioned? I've got one attached to a tabbed panel that controls all the enable features of the the various checkboxes etc. That's not working.

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 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

In my PastImageRoll script I used code I took from Mike Hale web post for handling keyboard events.   The code does not seemed to be triggered in CC 2015.

It was like the handlers that are in the Fit Image plug-in sctipt that have been commented out since CS6.   They work for me in PasteImageRoll up to CC 2015 but not in CC 2015.

// do not allow anything except for numbers 0-9

RollPaperDialog.PrintResPnl.docResEdt.addEventListener ('keydown', NumericEditKeyboardHandler);

RollPaperDialog.PrintResPnl.imgCpysEdt.addEventListener ('keydown', NumericEditKeyboardHandler);

RollPaperDialog.PaperSizePnl.aspectWidthEdt.addEventListener ('keydown', DesmalEditKeyboardHandler);

RollPaperDialog.PaperSizePnl.aspectHeightEdt.addEventListener ('keydown', DesmalEditKeyboardHandler);

RollPaperDialog.CellSizePnl.aspectWidthEdt.addEventListener ('keydown', DesmalEditKeyboardHandler);

RollPaperDialog.CellSizePnl.aspectHeightEdt.addEventListener ('keydown', DesmalEditKeyboardHandler);

RollPaperDialog.GroutSizePnl.aspectWidthEdt.addEventListener ('keydown', DesmalEditKeyboardHandler);

RollPaperDialog.GroutSizePnl.aspectHeightEdt.addEventListener ('keydown', DesmalEditKeyboardHandler);

Seems there are many things like this commented out in Adobe scripts supplied with Photoshop.  In contactsheetII   I see X now use code like this make me almost want to learn scripting

//

// Function: addNumericFilter

// Description: Adds a numeric keystroke filter to a widget

// Input:  obj - UI widget

// Return: <none>

//

ContactSheetUI.addNumericFilter = function(obj) {

  obj.keyFilter = /\d/;

  obj.addEventListener('keydown', ContactSheetUI.filterKey);

};

//

// Function: addNumberFilter

// Description: Adds a number/localized-decimal-point keystroke filter

// Input:  obj - UI widget

// Return: <none>

//

ContactSheetUI.addNumberFilter = function(obj) {

  obj.keyFilter = RegExp("[\\-" + psxui.dpREStr + "\\d]");

  obj.addEventListener('keydown', ContactSheetUI.filterKey);

};

//

// Function: addPositiveNumberFilter

// Description: Adds a positive number/localized-decimal-point keystroke filter

// Input:  obj - UI widget

// Return: <none>

//

ContactSheetUI.addPositiveNumberFilter = function(obj) {

  obj.keyFilter = RegExp("[" + psxui.dpREStr + "\\d]");

  obj.addEventListener('keydown', ContactSheetUI.filterKey);

};

JJMack

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
Advisor ,
Jun 25, 2015 Jun 25, 2015

Copy link to clipboard

Copied

When I was writing the ContactSheetII.jsx, the Quality Control people at Adobe were very, very specific about keystroke filters so I learned a lot about them writing up the code.

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 26, 2015 Jun 26, 2015

Copy link to clipboard

Copied

X there seems to be a big difference as to how ContactSheetII  UI works in CC 2015 and CC 2014 with some of the input fields it that because of the eventlistener code? The change seem to be in the panel. The CC 2014 version run in cc 2015 still seem to filter some of the numeric input fields not allow character be entered..

I use Mike Hale code for handling numeric input fields in several script and now that way does not work in CC 2015.   Your CC 2014 version of contacsheetII handles in CC 2015 some of your dialogs fields the way I want to.  However I do not know JavaScript only hack at it and I do not understand how your CC 2014 code works.

Could you please do me a favor a post a simple dialog that only allows numeric data to be entered into its input field that will work in CC 2015 and CC 2014.

I like the immediate feedback and not having to check if is not numeric and then have to putout a message and then re-display the dialog.  For that way I need to restructure my poor hacks.

Here the code Mike posted that no longer works in CC 2015  the keydown event handler is never triggered

function NumericEditKeyboardHandler (event) {

    try {

        var keyIsOK = KeyIsNumeric (event) || 

                      KeyIsDelete (event) || 

                      KeyIsLRArrow (event) ||

                      KeyIsTabEnterEscape (event);

                      

        if (! keyIsOK) {

            //    Bad input: tell ScriptUI not to accept the keydown event

            event.preventDefault();

            /*    Notify user of invalid input: make sure NOT

                to put up an alert dialog or do anything which

                requires user interaction, because that

                interferes with preventing the 'default'

                action for the keydown event */

            app.beep();

        }

    }

    catch (e) {

        ; // alert ("Ack! bug in NumericEditKeyboardHandler: " + e);

    }

}

//    key identifier functions

function KeyIsNumeric ( event ) {

    return  ( event.keyName >= '0' ) && ( event.keyName <= '9' ) && ! KeyHasModifier ( event );

}

function KeyHasModifier ( event ) {

    return event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;

}

function KeyIsDelete (event) {

    //    Shift-delete is ok

    return (event.keyName == 'Backspace') && ! (event.ctrlKey);

}

function KeyIsLRArrow (event) {

    return ((event.keyName == 'Left') || (event.keyName == 'Right')) && ! (event.altKey || event.metaKey);

}

function KeyIsTabEnterEscape (event) {

    return event.keyName == 'Tab' || event.keyName == 'Enter' || event.keyName == 'Escape';

}

function createDialog( ) {

    var dlg = new Window( 'dialog', 'Example Dialog' );

    dlg.maskSt = dlg.add( 'edittext', undefined, '' );

    dlg.maskSt.preferredSize.width = 40;

    dlg.maskSt.addEventListener ('keydown', NumericEditKeyboardHandler );

   dlg.btnPnl = dlg.add( 'panel', undefined, 'Process' );

   dlg.btnPnl.orientation = "row";

   dlg.btnPnl.alignment = "right";

   dlg.btnPnl.okBtn = dlg.btnPnl.add( 'button', undefined, 'Ok', { name:'ok' });

   dlg.btnPnl.cancelBtn = dlg.btnPnl.add( 'button', undefined, 'Cancel', { name:'cancel' });

   return dlg;

};

function initializeDialog( w ) {

    w.maskSt.addEventListener ('keydown', NumericEditKeyboardHandler );

    w.maskSt.onChanging = function() {

                                    // range check if needed

                                        if( Number(this.text) < 0 || Number(this.text) > 100 ){

                                            alert('Out of range');

                                            // handle however you like

                                            this.text = '';

                                        }

                                    }

    w.btnPnl.okBtn.onClick = function ( ) { this.parent.parent.close( 1 ); };

    w.btnPnl.cancelBtn.onClick = function ( ) { this.parent.parent.close( 2 ); };

};

runDialog = function( w ) {

   return w.show( );

};

var win = createDialog();

initializeDialog( win );

runDialog( win );

JJMack

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