5 Replies Latest reply on Feb 5, 2017 7:33 AM by Obi-wan Kenobi

    Is there a InDesign script that rotates objects based on a degree of rotation listed in .csv  file?

    jennlm

      I have 6665 images, I am using data merge with the inline merge script to place a flow of 9 square images on each page of my book. Now I need to rotate each image sequencially by -0.054 degrees. Example image one is rotated -0.054, image two by -0.108, image three -0.162 and so on until the last image has been rotated to -360 degrees. I have a .csv file that lists each rotation for each square object. Is there a script that could automate the 6665 rotations? If not, could you help me make one please? Thanks!!

        • 1. Re: Is there a InDesign script that rotates objects based on a degree of rotation listed in .csv  file?
          BobLevine MVP & Adobe Community Professional

          I suppose someone could write one. You might want to check in the scripting forum.

          • 2. Re: Is there a InDesign script that rotates objects based on a degree of rotation listed in .csv  file?
            jennlm Level 1

            Hi Bob Levine,

             

            Thank you so much for your response, I really appreciate it!

            I have searched the forums and while I have seen the question come up several times I haven't been able to find any scripts that have been made to solve the challenge. If you are willing to write one I would be eternally grateful! I have already spent many, many hours almost gone crazy copy and pasting rotation angles and I have only done 2500 manually so far.

             

            Best Regards,

             

            Jennifer

            • 3. Re: Is there a InDesign script that rotates objects based on a degree of rotation listed in .csv  file?
              BobLevine MVP & Adobe Community Professional

              I couldn’t write a script if my life depended on it.

               

              However, there are plenty of folks that I’m sure would be happy to give you a price quote for such a script. Again, check the scripting forum.

              • 4. Re: Is there a InDesign script that rotates objects based on a degree of rotation listed in .csv  file?
                jennlm Level 1

                Yes, I understand, I can't write script either!

                Thanks for your suggestion I will also post in the script forum, hopefully someone that can write script will reply! All the best!

                Jennifer

                • 5. Re: Is there a InDesign script that rotates objects based on a degree of rotation listed in .csv  file?
                  Obi-wan Kenobi Adobe Community Professional

                  Hi,

                   

                  Try this!

                   

                  app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Rotations+! …");
                  
                  
                  function main()     
                      {
                          var myPages = app.activeDocument.pages.everyItem().getElements(),  P = myPages.length,
                          myValue = 0,  myIncrementation = -2;
                          
                          for ( var p = 0; p < P; p++ ) {
                              var myImages = myPages[p].rectangles.everyItem().getElements(),
                              I = myImages.length;
                  
                  
                              while (I--) {
                                  var myRotation = app.transformationMatrices.add({counterclockwiseRotationAngle: myValue});
                                  myImages[I].transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, myRotation);
                                  myValue += myIncrementation;
                                  }
                          }
                      }
                  

                   

                   

                  Sample: incrementation = -2° (per column), from 0 to 30° (last one on right page)

                   

                  Capture d’écran 2017-02-04 à 23.27.12.png

                   

                  Variant:

                   

                  app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Rotations+! …");
                  
                  
                  function main()     
                      {
                          var myPages = app.activeDocument.pages.everyItem().getElements(),  P = myPages.length,
                          myValue = 0,  myIncrementation = -2;
                          
                          for ( var p = 0; p < P; p++ ) {
                              var myImages = myPages[p].allGraphics.everyItem().getElements(),
                              I = myImages.length;
                  
                  
                              while (I--) {
                                  var myRotation = app.transformationMatrices.add({counterclockwiseRotationAngle: myValue});
                                  myImages[I].transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.centerAnchor, myRotation);
                                  myValue += myIncrementation;
                                  }
                          }
                      }
                  

                   

                   

                  Capture d’écran 2017-02-05 à 12.11.43.png

                   

                  Warning: Frames order!

                   

                  Capture d’écran 2017-02-05 à 14.05.20.png

                   

                   

                  (^/)