8 Replies Latest reply on Sep 11, 2017 4:16 AM by Jarda Bereza

    Blocking the refresh of photoshop

    Julien_BOLBACH

      Hi,

       

      Is there a way in javascript to block the refresh of photoshop ?

      I'm having a script that is hiding and showing layers, but as I have hundreds of them, and photoshop refreshing the interface each time I change the visibility of a layer, it gets extremly slow ...

      I'm only interested but the end result, not the in-between steps.

       

      If you have any idea, please let me know !

       

      Thanks a lot,

       

      Julien

        • 1. Re: Blocking the refresh of photoshop
          Chuck Uebele Adobe Community Professional & MVP

          var idsetd = charIDToTypeID( "setd" );

          var desc3 = new ActionDescriptor();

          var idnull = charIDToTypeID( "null" );

          var ref2 = new ActionReference();

          var idPrpr = charIDToTypeID( "Prpr" );

          var idPbkO = charIDToTypeID( "PbkO" );

          ref2.putProperty( idPrpr, idPbkO );

          var idcapp = charIDToTypeID( "capp" );

          var idOrdn = charIDToTypeID( "Ordn" );

          var idTrgt = charIDToTypeID( "Trgt" );

          ref2.putEnumerated( idcapp, idOrdn, idTrgt );

          desc3.putReference( idnull, ref2 );

          var idT = charIDToTypeID( "T   " );

          var desc4 = new ActionDescriptor();

          var idperformance = stringIDToTypeID( "performance" );

          var idperformance = stringIDToTypeID( "performance" );

          var idaccelerated = stringIDToTypeID( "accelerated" );

          desc4.putEnumerated( idperformance, idperformance, idaccelerated );

          var idPbkO = charIDToTypeID( "PbkO" );

          desc3.putObject( idT, idPbkO, desc4 );

          executeAction( idsetd, desc3, DialogModes.NO );

          • 2. Re: Blocking the refresh of photoshop
            SylvanLady

            I have CS6 on Win 7 64 bit and the above code gives me an error: illegal argument.

             

            Any help?  My scripts are running quite slow due to all of the image refreshing and I'd love to be able to block that.

            • 3. Re: Blocking the refresh of photoshop
              Michael L Hale Level 5

              Some times this forum's software strips out what it thinks are extra spaces in text. Make sure that charIDToTypeID( "T   " ) has 3 spaces inside the quotes. CharIDs must have 4 characters.

              • 4. Re: Blocking the refresh of photoshop
                SylvanLady Level 1

                Thank you.  That solved my problem.

                • 5. Re: Blocking the refresh of photoshop
                  Jarda Bereza Level 4

                  Chuck Uebele:

                  I tried this code but I didn't see a change. Isn't it turned on by default in last Photoshop versions?

                  • 6. Re: Blocking the refresh of photoshop
                    Chuck Uebele Adobe Community Professional & MVP

                    It might be. I haven't really checked but I know I used to have to put it in some of my scripts so that they would change from acceleration mode to step mode for things like manual cropping, and some other applications.

                    • 7. Re: Blocking the refresh of photoshop
                      Davide_Barranca Adobe Community Professional

                      This is equivalent of setting the PlaybackOptions in the Actions panel:

                       

                      DB 2017-09-11 at 12.43.28.png

                      The code it gives in the SL (cleaned) is as follows – CC2017:

                       

                       

                      var s2t = function (s) {
                        return app.stringIDToTypeID(s);
                        };
                      
                        var descriptor = new ActionDescriptor();
                        var reference = new ActionReference();
                        var descriptor2 = new ActionDescriptor();
                      
                        reference.putProperty( s2t( "property" ), s2t( "playbackOptions" ));
                        reference.putEnumerated( s2t( "application" ), s2t( "ordinal" ), s2t( "targetEnum" ));
                        descriptor.putReference( s2t( "null" ), reference );
                        descriptor2.putEnumerated( s2t( "performance" ), s2t( "performance" ), s2t( "accelerated" ));
                        descriptor.putObject( s2t( "to" ), s2t( "playbackOptions" ), descriptor2 );
                        executeAction( s2t( "set" ), descriptor, DialogModes.NO );
                      

                       

                      Hope this helps,

                      Davide

                      • 8. Re: Blocking the refresh of photoshop
                        Jarda Bereza Level 4

                        Thanks David... now it makes sense.

                        So I assume that scripts in modern Photoshop are accelerated by default.