Skip to main content
Inspiring
January 11, 2016
Answered

Set zoom level for all open documents

  • January 11, 2016
  • 1 reply
  • 1073 views

I work with 2,3,4,5 and 6 open documents in Photoshop CC 2015.1.1 at once.

What is the simplest way to create a script that gets the number of open documents and sets a specific zoom level to all open documents?

Basic workflow

1- Select images in Bridge

2- Open BR images  in Photoshop

3- Photoshop >> Window >> Tile All Vertically

4- Run script set zoom level

This topic has been closed for replies.
Correct answer JJMack

The script needs to process all the open documents not just the active one when the scipt is run.

if (!documents.length) alert('There are no documents open.', 'No Document');

else {

  var saveActiveDoc = app.activeDocument;

  for (var i=0;i<documents.length;i++) {

     app.activeDocument = documents;

     runMenuItem(app.charIDToTypeID("ActP"));

     runMenuItem(app.charIDToTypeID("ZmOt"));

     runMenuItem(app.charIDToTypeID("ZmOt"));

  }

  app.activeDocument = saveActiveDoc;

}

1 reply

pixxxelschubser
Community Expert
Community Expert
January 11, 2016

Hi ojodegato‌,

there are examples for point 4

see:

Re: Set zoom in CS5

But this code posted by boo radley 2013 is a little bit "like a shot from behind through the chest in the eye"

Take one example (e.g. the code for 12.5%) and replace two lines

line 09 from:

activeDocument.resizeImage( undefined, undefined, getScreenRes()/(zoom/200.0), ResampleMethod.NONE );

to:

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

and line 17 from:

setZoom (25);

to:

setZoom (12.5); // the zoom level in percent you want e.g. 6.25, 8,33, 25 or something like 47,2

Have fun

ojodegatoAuthor
Inspiring
January 12, 2016

I try the script which works only on the active document. The other opened files in the background do not respond to the script.

Can the zoom level script apply to all open documents simultaneously?

JJMack
Community Expert
JJMackCommunity ExpertCorrect answer
Community Expert
January 12, 2016

The script needs to process all the open documents not just the active one when the scipt is run.

if (!documents.length) alert('There are no documents open.', 'No Document');

else {

  var saveActiveDoc = app.activeDocument;

  for (var i=0;i<documents.length;i++) {

     app.activeDocument = documents;

     runMenuItem(app.charIDToTypeID("ActP"));

     runMenuItem(app.charIDToTypeID("ZmOt"));

     runMenuItem(app.charIDToTypeID("ZmOt"));

  }

  app.activeDocument = saveActiveDoc;

}

JJMack