Skip navigation
Fritz Hansen
Currently Being Moderated

changing preset zoom increments

Sep 22, 2011 5:06 AM

Is it possible to change the preset zoom increments (ID CS5)? For a lot of my work, I find 225% or 250% is an optimum magnification for me. I can get it there manually by typing in my desired magnification, but it would be so much easier to just click the zoom tool (or, especially the keyboard shortcut) and get increments of 25 or 50 rather than 100.

 
Replies
  • Currently Being Moderated
    Sep 22, 2011 6:24 AM   in reply to Fritz Hansen

    The only way to customize zoom values is through scripting ( if you search, you should be able to find Dave Saunders' script to set the zoom for an accurate 100% view, which you can modify to have any percentage of your choosing). You can then assign a keyboard shortcut to the script, but you'd need a separate script/shortcut for each percentage you choose -- the Cmd (Ctrl) +/- shortcuts to zoom in or out won't use the custom values.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 8:01 AM   in reply to Peter Spier

    Peter, It should be possible to redefine those shortcut keys to run a

    script (well, 2 different scripts, I guess) which will either increase

    or decrease the the zoom to a set of predefined values.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Sep 22, 2011 8:36 AM   in reply to [Ariel]

    Everybody's right!

     

    It's a one-line script to set the zoom percentage of the active window. If you want to bind them to discrete keys, i.e. Cmd-1, Cmd-2, Cmd-4, you'll need 3 or 4 different scripts, one for each percentage.

     

    But yes, you could redefine the Cmd +/- shortcuts to a slightly more complicated script that checks the current value of the zoom for the active window and then increases or decreases it according to a rule of your own choosing.

     

    It's not feasible to use these methods to change the behavior the actual zoom tool, though, only the keyboard shortcuts. Honestly, I usually just use the marquee zoom feature to drag a box around what I want. That way I get near perfect zooming every time.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 11:24 AM   in reply to John Hawkinson

    Here's my attempt at a script to do this:

     

    /*

    Custom Zoom Percentages

    An InDesign CS4 script (c) Ariel Walden, FreelanceBookDesign.com, 2011

    To use: Add, remove or change the list of numbers between square

    brackets (zooms = Re: changing preset zoom increments) to whichever zoom percentages you like.

    IMPORTANT:

    (1) Make sure your zoom percentages are in ascending order!

    (2) Make sure they are separated by a comma!

    */

     

    try{

         zooms = Re: changing preset zoom increments;

         theWindow = app.activeWindow;

         reset = true;

         currentZoom = theWindow.zoomPercentage;

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

             if (currentZoom < zooms[i]){

                 newZoom = zooms[i];

                 reset = false;

                 break;

             }

         }

         if (reset) newZoom = zooms[0];

         theWindow.zoomPercentage = newZoom;

    }

    catch(e){}

     

    I work on CS4, so it's tested on that. Does it work in other versions?

     

    The script will cycle through the predefined zoom percentages, and when

    it reaches the end it will jump back to the smallest. This will save the

    need for two scripts (one to go up and one to go down) for some people.

     

    Thanks,

    Ariel

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Sep 22, 2011 11:35 AM   in reply to [Ariel]

    Ariel: Something horrible horrible has happened to the arrays in your post. Did you use the email interface? [I hope so, because otherwise there's a very serious new bug in the new version of the forum]: All of your arrays, in brackets, turned into URLs, to which the base URL for this thread was prepended. Can you edit your post online to fix them?

     

    Incidently, I would suggest that instead of listing "IMPORTANT: (1) Make sure your zoom percentages are in ascending order!" that you just use:

     

     

    zooms = [20,40,60,100,160,260,420,680].sort();
    

     

    so that it is a non-issue.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 11:55 AM   in reply to John Hawkinson
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 12:53 PM   in reply to John Hawkinson

    (Incidentally, if anyone would like to PM me about the script -- and get

    an answer before tomorrow(!) -- I'm only reachable on bookraft (at)

    googlemail.com right now.)

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 1:34 PM   in reply to [Ariel]

    Ariel, another empty post in response to John....

     

    I suspect it's quotes in your emails and Jive playing games.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Sep 22, 2011 1:36 PM   in reply to Peter Spier

    OK, I corresponded with Ariel offline, and s/he writes:

     

    Oh dear, sorry about the arrays. I did send this in by email, and I won't

    have access to the web until tomorrow to fix it. If you feel like

    reposting a corrected version meanwhile go ahead.

     

    I wonder if there's a way of adding tags to an email response to get the

    forum to format something as javascript (similar to the online option)?

     

    Good catch about using sort()!

     

    Ariel

     

    Upon request, I repost the revised script:

     

    /*
    Custom Zoom Percentages
    An InDesign CS4 script (c) Ariel Walden, FreelanceBookDesign.com, 2011
    To use: Add, remove or change the list of numbers between square brackets
    (zooms = [x, y, z, etc.]) to whichever zoom percentages you like.
    IMPORTANT: Make sure they are separated by a comma!
    */
      
    try{
        zooms = [20,40,60,100,160,260,420,680].sort();
        theWindow = app.activeWindow;
        reset = true;
        currentZoom = theWindow.zoomPercentage;
        for (i=0; i<zooms.length; i++){
            if (currentZoom < zooms[i]){
                newZoom = zooms[i];
                reset = false;
                break;
            }   
        }   
        if (reset) newZoom = zooms[0];
        theWindow.zoomPercentage = newZoom;
    }   
    catch(e){}
    
     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 1:43 PM   in reply to John Hawkinson

    Thanks, John.

     

    And Ariel is a He as far as I know.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 22, 2011 2:13 PM   in reply to John Hawkinson

    Thanks, John.

     

    Ariel, esq.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Sep 23, 2011 7:06 AM   in reply to Fritz Hansen

    Fritz:

     

    The scripting route seems a bit much for my needs, but I may try it.

    Since Ariel took the time to actually write the script for you, I strongly encourage you to try it! All the hard work is done, you just need to install it. (Save it as customZoomPercentages.jsx as a plain text file, not RTF, in a text editor, such as Notepad or TextEdit, and follow the instructions at http://www.danrodney.com/scripts/directions-installingscripts.html. Then bind it to a key in Edit > Keyboard Shortcuts under Scripts.

     

    (I know if I wrote a script for someone, I'd be kind of bummed if they didn't even try it!)

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 22, 2011 8:11 AM   in reply to Fritz Hansen

    Ariel, like former Israeli Prime Minister Ariel Sharon, is a man, for future reference.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2012 7:58 AM   in reply to Fritz Hansen

    Does this script work for Photoshop CS5 as well? I've never used scripts, but I have a need for a very specific preset zoom value or a quick shortcut to take me to an odd zoom level (38.5%) Thanks!

     

     

    Debbie

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2012 8:19 AM   in reply to bttrflygrl

    Debbie, there are some similarities between scripting for InDesign and for Photoshop, but only because both use the same language (Javascript). But there are vast differences in the Document Object Model -- the 'words' that you use to interrogate and command InDesign and Photoshop.

    The chance that this very same script, written especially for InDesign, works for Photoshop as well is extremely minimal. Even if it does, it'd be by pure chance alone, rather than by design or intention.

     

    But you could ask in the Photoshop scripting forum if there is something similar, or even if Ariël's script can be re-worked for PS.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2012 3:15 PM   in reply to [Jongware]

    just stumbled on this old thread (I found the default zooms must've changed between cs5 and cs6 because I take screen shots of a layout I regularly do and they are now eiither too big or too small).  In Cs6 on windows I couldn't get the script to work - either zooming with the zoom tool or with keyboard (ctrl +/_).  the script is insale din the application folder. When I run the script it jumps the active document to 99% soom.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Dec 23, 2012 4:13 PM   in reply to getho

    Did you try the version of the script I posted in post #9? Note that the script does not change the behavior of the zoom tool, nor of Ctrl+-/-.  You'll need to run the script (double click) it to change the zoom. Run it repeatedly to cycle through the set of zooms.

     

    Assuming that works, than you can use Edit > Keyboard Shortcuts to set a key to tun the script (and that could be Ctrl + if you like).

     

    In CS6, the standard of comparisons for zooms changed. 100% zoom now factors into account your screen's physical size, so it looks larger than it did in CS5 (substantially so).

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 28, 2013 6:06 PM   in reply to John Hawkinson

    Hi John,

    sorry for delay there - christmas happened! thanks for the info re cs6 sizing - I was wondering what had changed

    yes just double checked its the right version.

     

    double clicking the script in the user folder of the script panel still makes it jump to 99%, subsequent double clicks dont do anything.

     

    I found this page: http://indesignsecrets.com/custom-zoommagnification-settings-in-indesi gn.php

     

    So I tried chaging the do something bit to:  app.layoutWindows[0].zoomPercentage = newZoom;

     

    And a few other hacks (I dont really know what I'm doing), and I stuck an alert in to report the value of newzoom.  It kept reporting 100. So I took out the  if (currentZoom < zooms[i]) test and it cycled through all the available values (but seemingly randomly) before ending at 680.  ACtually the sort is sorting them like this:

     

    100,160,20,260,40,420,60,680

     

    So its sorting them sort of alphabetically!  And it explains why it is zooming to 100 first.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Jan 28, 2013 6:14 PM   in reply to getho

    100,160,20,260,40,420,60,680

     

    So its sorting them sort of alphabetically!  And it explains why it is zooming to 100 first.

    How embarassing!

     

    Indeed, JavaScript's sort is lexicographic not numeric.

    You could fix this with

     

    [20,40,60,100,160,260,420,680].sort(function(a,b) { return a-b; });
    

     

    but it might not be worth the trouble...

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 4, 2013 12:45 AM   in reply to John Hawkinson

    Hi John

    does this actually work for you though - because when I said it was cycling through the values it was only in an alert that I inserted, it sill wouldn't zoom at all.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 4, 2013 1:48 AM   in reply to getho

    Just in case you changed a bit too much in Ariël's original script, here is the amended version (it appears to me it works as it's supposed to):

     

    /*
    Custom Zoom Percentages
    An InDesign CS4 script (c) Ariel Walden, FreelanceBookDesign.com, 2011
    To use: Add, remove or change the list of numbers between square brackets
    (zooms = [x, y, z, etc.]) to whichever zoom percentages you like.
    IMPORTANT: Make sure they are separated by a comma!
    */
      
    try{
        zooms = [20,40,60,100,160,260,420,680].sort(function(a,b) { return a-b; });
        theWindow = app.activeWindow;
        reset = true;
        currentZoom = theWindow.zoomPercentage;
        for (i=0; i<zooms.length; i++){
            if (currentZoom < zooms[i]){
                newZoom = zooms[i];
                reset = false;
                break;
            }   
        }   
        if (reset) newZoom = zooms[0];
        theWindow.zoomPercentage = newZoom;
    }   
    catch(e){}
    
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 6:21 PM   in reply to [Jongware]

    thanks

    on cs6 it works for 4 goes, then stops!? Just tried changing the values and it now only zooms the first increment.

    AH I see whats happening  - with the default values its zooming 20,40,60,99.  AS soon as it hits a non-round zoom value its crapping out.

     

     

    ah well its frustrating but I've found this little script which is doing what I need:

     

    try {app.layoutWindows[0].zoom(ZoomOptions.FIT_PAGE);

        app.layoutWindows[0].zoomPercentage = Number(app.activeScript.name.match(/\d+/)[0]);} catch (e) {};

     

    it zooms the amount in the name of the script: eg zoom65.jsx

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 3:26 AM   in reply to getho

    Getho, that's really strange. It works on CS4, even with 'non-round' values such as 99% and 101%. I cannot imagine it would work any different for CS6 -- but I'll try it at home tonight, where I have CS6 installed.

     

    getho wrote:

     

    .. it zooms the amount in the name of the script: eg zoom65.jsx

     

    Yeah, one of my brighter ideas

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points