Skip navigation
Max Penson
Currently Being Moderated

Photoshop can't respond while on modeless?

Jan 8, 2012 9:50 PM

Hi all,


Photoshop seems not to respond to csawlib while the extension window is set on modeless. For instance, I have a simple extension that has just one button. When pressing that button I run this code:


                               var app:Application =;

                               var myLayer:ArtLayer = app.activeDocument.activeLayer as ArtLayer




It works fine when the extension is configured as a panel, but when configuring the extension as modeless, Photoshop is unavailable to take the call:


Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.

- The command “Gaussian Blur” is not currently available.


Am I doing something wrong here?

  • Currently Being Moderated
    Jan 18, 2012 9:41 PM   in reply to Max Penson

    No help from me; just another cry for help :-(


    I'm currently bumping into something that looks very similar. In some of my Extensions, I cannot talk to Photoshop. In the debugger, looks 'ok', but is always 0 even if there are documents open.


    I tried to get around is using ExtendScript, but when I try to do things like jsxInterface.eval("app.documents.length") I get a very similar error message - Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.


    I have not been able to figure out why this happens - when I start with a brand new extension it works fine.


    I was using modeless windows - but even when reverting to a panel, nothing improves.

    Mark as:
  • Currently Being Moderated
    Jan 19, 2012 8:44 AM   in reply to RorohikoKris

    Hi Guys,


    To my knowledge, this is the first time this issue with modeless windows has been raised. I know I haven't seen it (but can't recall specifically if I've ever made a modeless window in Ps). Could you send an example that manifests the bug?


    There is a known bug in PS that prevents using the CSAW lib downstream of a system event. That bug manifests with the same error, and sometimes a Ps crash.


    It's possible you're seeing something related caused by the modeless context. You could try using the workaround posted here: oshop_CS5_Re-17727.html


    If I can get an example, I'll have a look at it today.






    Mark as:
  • Currently Being Moderated
    Jan 19, 2012 11:34 AM   in reply to Max Penson

    When I look at the script listener output, I see something way different from what you have in your code.


    What I see is in the dupeLayer function (shown below).


    If I replace your code with something like this:


    function run()


              alert("We have a JS link");

              #target photoshop


    //           var idCpTL = app.charIDToTypeID( "CpTL" );

    //     executeAction( idCpTL, undefined, DialogModes.NO );


    function dupeLayer() {

              var idDplc = charIDToTypeID( "Dplc" );

                        var desc7 = new ActionDescriptor();

                        var idnull = charIDToTypeID( "null" );

                                  var ref5 = new ActionReference();

                                  var idLyr = charIDToTypeID( "Lyr " );

                                  var idOrdn = charIDToTypeID( "Ordn" );

                                  var idTrgt = charIDToTypeID( "Trgt" );

                                  ref5.putEnumerated( idLyr, idOrdn, idTrgt );

                        desc7.putReference( idnull, ref5 );

                        var idVrsn = charIDToTypeID( "Vrsn" );

                        desc7.putInteger( idVrsn, 5 );

              executeAction( idDplc, desc7, DialogModes.NO );



    Clicking your button from the modless window successfully copies the selected layer.


    As to why...


    My OPINION - Photoshop is selection and state oriented. Any number of Photoshop actions may not available depending on the application's state and what is or is not selected. When attempting to do certain things from a modeless window compared to a panel - the mere presence of the modeless window changes the state of Photoshop (e.g Ps can't be the front-most window when the modeless is showing). My thinking is that the action descriptor you were using is in fact not available when a modless is showing, and is from the panel. The action descriptor code that I used evidently does not have such a restriction.


    I can't state the above as fact, I am only making an educated guess based on the behaviors I have seen before and what I see in this case.



    Mark as:
  • Currently Being Moderated
    Jan 19, 2012 11:51 AM   in reply to Max Penson

    I installed the script listener, launched Photoshop. Created a document, selected and duplicated a layer. I then took the script listener output and pasted it into a js function.


    Why the listener code I copied worked while yours did not (I did verify that yours does work from a panel), I think has to do with Ps' state, but I can't be certain.



    Mark as:
  • Currently Being Moderated
    Jan 31, 2013 12:20 AM   in reply to Bob Stucky

    Hi Bob,


    Just want to add that I'm also running into the "The command XXX is not currently available" error. I'm trying to create a photoshop extension for CS5 and CS6 that runs in a dialog. For example, when I try to do "" it fails on CS5.1 on Windows 7 if the dialog is modal (it works if the dialog is modeless). It also fails on Photoshop CS6 on Mac OS X 10.7 when in a dialog (modal and modeless, neither works). It works fine in Photoshop CS6 on Windows (modal and modeless, both works in this case). Note that I am using the forceClean workaround that you created for PS CS5 on Mac, to no avail. Are these known limitations in the CS SDK? Any plans to fix? Thank you!




    Mark as:
  • Currently Being Moderated
    Mar 20, 2013 10:51 AM   in reply to Daniel_Andefors

    Hi again,


    Any update on above? I'm really interested to learn if there are any plans to fix the issue with PS on Mac that I explained above or if you can recommend a workaround. Thanks!

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points