8 Replies Latest reply: Mar 20, 2013 10:51 AM by Daniel_Andefors RSS

    Photoshop can't respond while on modeless?

    Max Penson Community Member

      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 = Photoshop.app;

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

                                               myLayer.applyGaussianBlur(30);

       

       

      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?

        • 1. Re: Photoshop can't respond while on modeless?
          RorohikoKris Community Member

          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, Photoshop.app looks 'ok', but Photoshop.app.documents.length 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.

          • 2. Re: Photoshop can't respond while on modeless?
            Bob Stucky Adobe Employee

            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: http://cookbooks.adobe.com/post_Creative_Suite_Extensions_and_the_Photoshop_CS5_Re-17727.h tml

             

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

             

             

            Regards

             

            Bob

            • 3. Re: Photoshop can't respond while on modeless?
              Max Penson Community Member

              Hi Bob,

               

              Thank you for looking into this. I've made you a simple project that duplicates a layer via JS.

               

              Here:

              http://www.2shared.com/file/nQaak4xc/Modeless.html

               

              When set to Modeless it does not work, but when set to panel it duplicats the layer just fine.

               

              Thanks!

              • 4. Re: Photoshop can't respond while on modeless?
                Bob Stucky Adobe Employee

                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

                          dupeLayer()

                //           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.

                 

                Regards

                • 5. Re: Photoshop can't respond while on modeless?
                  Max Penson Community Member

                  Thank you!

                   

                  Yeah that makes sence. How did you produce that action descriptor? I mean, if this photoshop funciton is not abilable when the window is in focus, how did you chnage the focus back to photoshop?

                   

                  Thanks again.

                  • 6. Re: Photoshop can't respond while on modeless?
                    Bob Stucky Adobe Employee

                    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.

                     

                    Regards

                    • 7. Re: Photoshop can't respond while on modeless?
                      Daniel_Andefors Community Member

                      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 "Photoshop.app.activeDocument.save()" 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!

                       

                      Regards,

                      Daniel

                      • 8. Re: Photoshop can't respond while on modeless?
                        Daniel_Andefors Community Member

                        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!