6 Replies Latest reply on Jun 28, 2017 7:58 AM by klippCW

    Scale all anchored objects in a frame

    kalabaleek

      Hi there,

       

      I'm designing a 200 page presentation with index pages every tenth page (these sections are separate documents within an indesign book) with clickable thumbnails rendered via Table of Contents.

       

      Each page consists of a "content frame" in which i got a "TOC paragraph style" with a heading and an anchored image underneath. This is to be able to quickly create a "table of contents" consisting of thumbnails of each page that's clickable.

       

      The problem is that when I render the ToC, the linked anchor images are full size, and thus my placed frame with the finished ToC obviously cant fit all ten "thumbnails". When i scale down the frame including all these images; only the anchors visible when scaling get adjusted and nothing else...

       

       

      So what I would like to do is select this "ToC-frame" and run a script that resize all included anchored objects to 20% of their original size relative to their centres.

      When i do this manually by clicking the anchor objects and resizing them it all flows all good and well. But that's gonna be too much manual labor to effectively render these thumbnail ToCs as our client is a Master of Changes.

       

       

      Do you guys n gals follow what I mean or should I further explain my problem?

       

       

      Huge thanks in advance for any guidance in the right direction

       

       

      /Kent

        • 1. Re: Scale all anchored objects in a frame
          absqua Level 4

          Try this:

           

          function main() {

            var frame = app.selection[0],

                matrix = app.transformationMatrices.add({horizontalScaleFactor: 0.2, verticalScaleFactor: 0.2});

           

            if (frame instanceof TextFrame) {

              frame.pageItems.everyItem().transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, matrix);

            }

          }

           

          if (app.selection.length) {

            app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Scale Inline Page Items to 20%");

          }

           

          Jeff

           

          Does anyone know: Did the "Use Advanced Editor" button with the syntax formatting go away?

          1 person found this helpful
          • 2. Re: Scale all anchored objects in a frame
            kalabaleek Level 1

            Hey Jeff and big thanks for the suggestion!

             

            However, this script only resize the visible anchors as well, and not the ones overflowing the frame.

            The script do tell indesign to resize every item, but still doesn't transform anchors outside the visible frame...

             

            Darnit.

             

            Maybe we can change the transformation to a specific size instead of a relative percentage?

            Like 50x35 mm...

             

            That way I could simply spam the script until all thumbs are the correct size?

            • 3. Re: Scale all anchored objects in a frame
              Laubender Adobe Community Professional & MVP

              Does anyone know: Did the "Use Advanced Editor" button with the syntax formatting go away?


              @absqua – there are a lot issues with the new forum skin:

               

              http://forums.adobe.com/message/4382597#4382597

               

              I have no idea if and when they will be ironed out…


              //EDIT AFTER POSTING:

              P.S. If you edit your posting after submitting you can easily have access to the advanced editing features:

               

              AdvancedEditing.png


              Uwe

               

              Message was edited by: Laubender

              • 4. Re: Scale all anchored objects in a frame
                absqua Level 4

                Thanks Uwe.

                 

                Kent: That can easily be fixed by addressing the story rather than the frame:

                 

                frame.parentStory.pageItems.everyItem().transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, matrix);
                

                 

                But you will then be scaling all the inline and anchored objects in any threaded frames as well.

                 

                Jeff

                • 5. Re: Scale all anchored objects in a frame
                  kalabaleek Level 1

                  ACE!

                   

                  Thank you so much, that nailed it!

                  • 6. Re: Scale all anchored objects in a frame
                    klippCW

                    Hello Jeff! I know it's over 5 years later, but I'm finding the need to scale inline objects to a specific measurement, just like kalabaleek mentioned:

                     

                    "Maybe we can change the transformation to a specific size instead of a relative percentage? Like 50x35 mm..."

                     

                    I saved this script years ago to scale everything to a certain percentage which was helpful, but now I find myself needing to amend it to be a static, specific size. (13mm x 20mm, to be more specific).

                     

                    Is that possible to add into the script here:

                     

                    function main() {

                      var frame = app.selection[0],

                          matrix = app.transformationMatrices.add({horizontalScaleFactor: 1.25, verticalScaleFactor: 1.25});

                     

                      if (frame instanceof TextFrame) {

                        frame.parentStory.pageItems.everyItem().transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, matrix);

                      }

                    }

                     

                    if (app.selection.length) {

                      app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Scale Inline Page Items to 125%");

                    }