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

control document window size/position?

Explorer ,
Aug 15, 2016 Aug 15, 2016

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?

TOPICS
Actions and scripting
1.3K
Translate
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

correct answers 1 Correct answer

Community Expert , Aug 15, 2016 Aug 15, 2016

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

...
Translate
Adobe
Enthusiast ,
Aug 15, 2016 Aug 15, 2016

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.

Translate
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 ,
Aug 15, 2016 Aug 15, 2016

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 )");

Translate
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 ,
Aug 15, 2016 Aug 15, 2016

Nice hack... image resize without resizing image used for zoom 🙂 😄

You also can run menu items for

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

Translate
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 ,
Aug 15, 2016 Aug 15, 2016
LATEST

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

Translate
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