4 Replies Latest reply on Aug 15, 2016 2:07 PM by squirpy

    control document window size/position?

    squirpy Level 1

      Is there any way to us javascript (or anything else) to control the document window size (33.3%, 66.6%, etc) or position on-screen?

        • 1. Re: control document window size/position?
          Jarda Bereza Level 4

          I would try to write AutoHotkey script (windows) and then compile it in .exe file and you could run it from script. Maybe you could run this exe file with arguments, which will contains size and position. Maybe somebody already did program like this.

           

          You can move window which are created by UI Scripting (.jsx) (not document window, but maybe some some default dialogs)

          You can change workspaces but it doesn't include document window.

          You can run menu items: Window > Arrange

          You can read number of displays and their dimensions.

          • 2. Re: control document window size/position?
            c.pfaffenbichler Level 9

            As for the zoom:

            // by michael l hale;

            function setZoom( zoom ) {// as percent

               cTID = function(s) { return app.charIDToTypeID(s); }; // from xbytor

               var docRes = activeDocument.resolution;

               activeDocument.resizeImage( undefined, undefined, 72/(zoom/100), ResampleMethod.NONE );

               var desc = new ActionDescriptor();

               var ref = new ActionReference();

               ref.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), cTID( 'PrnS' ) );

               desc.putReference( cTID( "null" ), ref );

               executeAction( cTID( "slct" ), desc, DialogModes.NO );

               activeDocument.resizeImage( undefined, undefined, docRes, ResampleMethod.NONE );

            };

            app.activeDocument.suspendHistory ("zoom", "setZoom( 65 )");

            1 person found this helpful
            • 3. Re: control document window size/position?
              Jarda Bereza Level 4

              Nice hack... image resize without resizing image used for zoom :-) :-D

               

              You also can run menu items for

              100% size and then increase or decrease zoom and use another similar commands

              • 4. Re: control document window size/position?
                squirpy Level 1

                Michael Hale's function to resize windows is exactly what I needed for this part, thanks!

                 

                Positioning them after they are at the correct size is proving to be much more challenging. Window > Arrange > Cascade/Tile is not doing what I need. I essentially would like the small windows lined up at the top of the screen with no overlap.

                 

                Moving windows does nothing in the ScriptListener which leads me to believe this is not something that can be accomplished by running javascript from the scripting menu.

                 

                Can this be accomplished with Applescript or any other 3rd party tools? Moom gave me hope, but it looks like it doesn't work on Photoshop.

                 

                EDIT: It appears the reason Moom and Applescript cannot handle this are one and the same: Photoshop has implemented it's own non-standard way of handling windows. Oh well, one of of two ain't bad....