Skip to main content
tomaxxi
Inspiring
December 7, 2010
Answered

Get current Zoom level

  • December 7, 2010
  • 2 replies
  • 8050 views

Hey!

One simple question, but unfortunately I can't find the answer

How to get current zoom level with scripting?

I want to rescale image using Percent units to current zoom level.

Thanks!

--

tomaxxi

http://indisnip.wordpress.com/

This topic has been closed for replies.
Correct answer Paul Riggott

Please try this...


alert(zoomLevel());

function zoomLevel(){
if(!documents.length) return;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
return desc.getDouble(stringIDToTypeID('zoom'))*100;
}

2 replies

Paul Riggott
Paul RiggottCorrect answer
Inspiring
December 7, 2010

Please try this...


alert(zoomLevel());

function zoomLevel(){
if(!documents.length) return;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
return desc.getDouble(stringIDToTypeID('zoom'))*100;
}

tomaxxi
tomaxxiAuthor
Inspiring
December 7, 2010

Thanks Paul!

What a difference between Photoshop and InDesign scripting!

InDesigns one row against four Photoshop rows!

Thanks!

--

tomaxxi

http://indisnip.wordpress.com/

c.pfaffenbichler
Community Expert
Community Expert
December 7, 2010
What a difference between Photoshop and InDesign scripting!

Have you ever tried Scripting for Illustrator?

Now that has great potential for frustration, in my opinion.

Harbs.
Legend
December 7, 2010

app.activeWindow.zoomPercentage

Harbs

tomaxxi
tomaxxiAuthor
Inspiring
December 7, 2010

Photoshop Harbs, Photoshop

Harbs.
Legend
December 7, 2010


I saw your name and didn't bothr checking which forum it was in...

Harbs