Skip navigation
Currently Being Moderated

Changing the keyboard increment when...

Mar 10, 2013 1:36 PM

I would like to change the keyboard increment when attmpting to increase/decrease the size of an image using command-option-< and >

 

Currently it jumps in the oddest incrememnt, not even a whole number. Increasing the size from 100% makes the result 105.10100501000001% Where does THAT come from?

 

I'd like to be able to change it, to, say, 5% increments or 2% increments. Any guesses?

 
Replies
  • Currently Being Moderated
    Mar 10, 2013 1:39 PM   in reply to Joe Duhamel

    What version of ID are you using, and what OS?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 1:49 PM   in reply to Joe Duhamel

    According to the built-in keyboard shortcuts, when you scale objects with keystrokes (Product Area: Object Editing), these are hard-wired. On a Mac, they are:

     

    Increase scale by 1% --- Default: Cmd+.

    Increase scale by 5% --- Default: Opt+Cmd+.

     

    The keyboard increments that are editable in Preferences > Units and Increments are cursor key movement, baseline shift for type, size/leading for type, and kerning/tracking for type.

     

    And I get the same small "rounding error" on my Mac in OS X 10.8.2 with the increase by 5%:

     

    100% becomes 105.1010...%

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 1:46 PM   in reply to Peter Spier

    Hmmmmm.

     

    I'm seeing the same thing here in Windows 7 from CS4 forward.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 1:52 PM   in reply to Peter Spier

    I was going to say it looks like a change in the algorithm, and that it's doing a recursive multiply in 1% steps, but that isn't it, either.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 1:54 PM   in reply to Joe Duhamel

    That's Cmd + . or Cmd + Opt + . (the period). Easier to think of that as the > key in this case, and instead of , (comma) for going the other direction, think of <.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 2:04 PM   in reply to Joe Duhamel

    Actually, it IS the recursive multiplication. I was doing 1.1 instead of 1.01 on the calculator a few minutes ago.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 3:24 PM   in reply to Joe Duhamel

    You'd have to ask the engineers why. But waht it's doing is multiplying by 1.01 each time you hit the shorcut (or 5 times, for the larger jump), rather than taking the 100% dimension, calculating the percentage of that and adding it.

     

    I have som vague memories of someone, Sandee Cohen, I think, complaining about this new behavior when it changed, and somebody else writing a script to emulate the old method, but I don't know that I have the script.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 10, 2013 4:28 PM   in reply to Peter Spier

    A Google search turns up this previous discussion and a link to the script:

     

    http://forums.adobe.com/message/2313057?tstart=0

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 4:28 AM   in reply to Steve Werner

    @Steve – as far as I can see right now, the mentioned script will not work as expected.
    At least in my version of InDesign (CS5.5 v7.5.3).

    Something is deeply wrong. The script goes back to InDesign CS3, I think. And things obviously have changed (again) since then…

     

    So with the script I get the same results like hitting the keyboard shortcuts:

     

    Example with "scale up by 1percent.jsx" on a selected rectangle that holds an image placed with 100%:

     

    1. result 101%

    2. result 102.01 %

    3. result 103.0301 %

     

    My conclusion: the script is using an "outdated" method of scaling.

     

    I have to investigate further…

    I'll be back soon to publish a script that will work. It will use a transformation matrix.

     

    Just have to do some further testing.
    Basically with two states an InDesign document can handle scaling (defined at preferences):

     

    1. Apply to Content
    2. Adjust Scaling Percentage

     

    I prefer no. 1.

     

    And, as I can already see,  my script will  work with both options, but the right values can only be seen after you redefine the scaling to 100% with the Transformation Panel…

     

    Of course, I can easily implement this in the script.
    But the question is: should I?
    Does the user make good use of not using option 1 in the preferences and stays with "Adjust Scaling Percentage"?

     

     

    My script will have some extra features (opposed to the old one):

     

    1. undo in one go
    2. will not scale objects that have no graphics
    3. will not give an error if locked objects are selected

     

    It will work in InDesign CS4 and above.
    But again: I have to test that…

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 4:31 AM   in reply to Laubender

    Oh. And please comment on the "extra" feature list. Maybe you WANT to scale all selected objects? Also the locked ones?
    That may depend on your individual use case…

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 6:48 AM   in reply to Laubender

    Uwe, would this script only be used on frames containing an image? The concept of 'scale' is a bit hazy for regular rectangles -- maybe that's why ID always reports '100%', whatever you size them to. So, scaling up by 1% twice is not double that of the original size -- it's a kind of Compound Interest thing.

     

    If you want to scale an "image" up by 1% (both the image and its frame), you need to jump through some hoops. Without trying it myself: (a) read original image scale, (b) add 1% to it, (c) add 1/(old_image_scale) to the frame's scale. I'm not too sure that's the right way to do it and worse: I don't know what scaling the frame and image independently of each other will do with the image position inside the frame.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 6:53 AM   in reply to Laubender

    Uwe,

     

    Were you still using the keyboard shortcuts? Did you reassigne them to run the scripts? I just installed them in CS6 in a Version 6.0 Scripts subfolder and they work as I would expect from the scripts panel. I didn't make a new set of KB shortcuts, nor test them loose.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 7:09 AM   in reply to Peter Spier

    @Peter – I did not test with InDesign CS6, just CS5.5. I just doubleclicked in the Scripts Panel.
    And my preferences were set to:

     

    Scaling: Apply to Contents

     

    Maybe this is just a CS5.5 issue. Had no time for further testing…

     

    @Jongware –  finished one script, but did not test much.
    The one that just scales frames + contents in increments of 1%, if contents is a graphic.

     

    See for yourself:

     

     

    //ScaleUP_by_increment_of_ONE_Percent_WITH_TRANSFORMATIONMATRIX.jsx
    //Uwe Laubender
     
     
    /**
    * @@@BUILDINFO@@@ ScaleUP_by_increment_of_ONE_Percent_WITH_TRANSFORMATIONMATRIX.jsx !Version! Mon Mar 11 2013 11:51:54 GMT+0100
    */
     
    //DESCRIPTION: Step of scaling UP: 1%
     
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
     
    app.doScript(_ScaleGraphicsOfSelection, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Scale All Graphics of Selection: UP BY 1 PERCENT");
     
     
     
    function _ScaleGraphicsOfSelection(){
     
    var percentage = 1; //You can change the amount here
     
    var sel = app.selection;
     
    if(sel.length === 0){alert("There is nothing selected! Try again…");exit(0);};
     
    for(var n=0;n<sel.length;n++){
        
        //Check, if the individual selected object is of type "Rectangle", "Oval" or "Polygon".
        //AND check, if the individual selected object has a graphic (objects without graphics should not be scaled!).
        //AND check, if the individual selected object is locked => we will not unlock the object to scale it.
        
        if(sel[n].constructor.name == "Rectangle" 
            || sel[n].constructor.name == "Oval" 
            || sel[n].constructor.name == "Polygon" 
            && app.selection[n].graphics[0].isValid 
            && app.selection[n].locked == false
            ){
            
            var currObject = sel[n];
     
            var currHScaleGraphic = currObject.graphics[0].horizontalScale;
            var currVScaleGraphic =currObject.graphics[0].verticalScale;
     
            var HFactor = ((currHScaleGraphic +percentage) / currHScaleGraphic);
            var VFactor = ((currVScaleGraphic +percentage) / currVScaleGraphic);
     
     
            var newTM = app.transformationMatrices.add({horizontalScaleFactor: HFactor, verticalScaleFactor: VFactor});
     
            currObject.transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, newTM);
            
            //OPTIONAL:
            currObject.redefineScaling();
            
            };
        };
     
    }; //END function "_ScaleGraphicsOfSelection()";
    

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 7:35 AM   in reply to Laubender

    You do get different results depending on if you choose the frame or the content. If the content is chosen, the script will smoothly scale in 1% increments.

     

    On the other hand, if you choose the frame, you are scaling the frame and content together, so you scale the frame itself in smooth 1% increments, but you are also scaling the scaled content by 1%, which is the same thing that the keybaord shorcut does if you select the content and not the frame, if that's clear. This is, in my opinion, what users should expect when the preference is set to apply to content. There is not a direct relationship at any particular time between the frame size (which is always 100% in this scenario) and the scale of the content.

     

    This is a different behavior, though than I see in CS3 (and I think it changed in CS4, but haven't taken the time to confirm). In CS3 when I use the keybaord shortcut with the frame selected, only the frame scales, not the content. Im CS6 both are scaling in tandem. I have apply to content set in the prefs in both versions. The scripts seem to work identically in both versions.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 7:58 AM   in reply to Peter Spier

    @Peter – just to make that clear:
    are you talking about the "old" script set Steve Werner has pointed to?

     

    I must admit, that I'm a little confused right now.
    Have to find time for further testing.

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 8:51 AM   in reply to Laubender

    Yes, the scripts from Steve's link. I don't have yours installed. I was responding to your assertion that they did not work, and I think that they actually do work as they are intended -- again given the difference between scaling the frame and content, or just the content.

     

    My contention is that if you were NOT to multiply the content scale by 1.01 when scaling the frame, but rather add 1% to the content scale, you would be affecting the fit (that's what happens in CS3 with the keyboard shortcuts since the content does not scale withthe frame) and would ultimately either crop the image or leave white space around it.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 10:09 AM   in reply to Peter Spier

    Ok then.

     

    My observation using the scripts from Steve's link is (CS3, CS4, CS5, CS5.5), that if you use the script repeatedly with an image container selected AND your scaling preferences are set to "Apply to Contents", the image is not scaled to exact percentages (100 => 101 => 102 => 103), but to the odd amounts you see, if you use the keyboard shortcut cmd + . (100 => 101 => 102.01 => 103.0301 etc.)

     

    To get "real" 101, 102, 103 etc. percentage values for the image, you can select the image container and use my script on that.

     

    If you use the "old" script and change the scaling preferences to "Adjust Scaling Percentage", you'll see percentages like 101, 102, 103 etc. on the the container and 100% on the image itself. This result seems ok for me: In the moment you will apply "Redefine Scaling to 100%" from the Transformation Palette,  the container will get a 100% value, the image inside will change to 101, 102 or 103 % depending on how often you used the script.

     

    If you are using my script for this scenario AND do not include the optional line currObject.redefineScaling(); you will see no different result in both scripts.
    If you leave the line included, you'll get a 100% container with 101, 102, 103 etc.

     

    In CS3 things are different.
    There you can use the "old" script and get results like 101, 102, 103 etc. both on the container and the image, if you select the container when set the scaling preferences to "Adjust Scaling Percentage". Both, container and image are scaled in tandem, which is not possible with cmd + .

     

    I'm testing with InDesign CS3 (v5.0.4), CS4 (v6.0.6), CS5 (v7.0.4) and CS5.5 (v.7.5.3), all German on Mac OSX 10.6.8.

     

    Uwe

     

    Message was edited by: Laubender

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 10:17 AM   in reply to Laubender

    I believe you and I are seeing the same thing with the old scripts.

     

    From what you are saying, I think also that your script does not scale the container in whole percentages, but scales the content in whole percentages, then adjusts the container to maintain the cropping, which is not necessarily an even percentage change on the size of the container. Is that essentially true?

     

    I don't think there's anything wrong with that approach, as long as it's understood, but I suspect if most users select a frame and increase the scale by 1% or 5% they expect the dimensions of the container to change by that much, and don't care if teh content is scaling to a different percentage, as long as the cropping does not change.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 2:54 PM   in reply to Peter Spier

    @Peter – with my script the container (together with the image) is scaled in one step. The amount is derived from the image. The cropping does not change, if the x and y scaling value of the image is the same… And if the image is not rotated.

     

    A few tests show, that if x and y resolution of the image is different, the script will scale according to both image scale percentages (that is by concept). And that, of course, is not the result I intended. Then the cropping does change. Left alone that the image percentages will be odd…


    Other problem arise: rotated images…
    The rotation angle will be changed, the shear angel (skew) will be changed as well…

     

    Ok. Points taken. Forget my script. I will rethink the whole thing.

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 3:01 PM   in reply to Laubender

    Oh dear. I didn't mean to dump on your script. I just didn't understand why you thought the old scripts didn't work, and was trying to point out that they behaved as I would expect, given my own preferences for scaling behaviors depending on if I've selected the container or the content.

     

    As I said before, I think maybe your expectations for scaling when selecting the container are different from mine, and that's perfectly OK.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 11, 2013 3:31 PM   in reply to Peter Spier

    @Peter – no problem at all… :-)

    But I will sleep it over. Tomorrow and the day after I'm already full with work for clients.
    I will get back to scripting in about two days…

     

    Until then, have a good time!

     

    Uwe

     
    |
    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