2 Replies Latest reply on Aug 31, 2010 4:38 AM by Maria964

    Crop frames

    Maria964 Level 1

      Hi,

      I am going to work in a large text book with hundreds of pages and thousands of inline graphics.

      The graphics are wmf files pasted in Word files and the software that generated those graphics

      created a blank box around the content of each one. This blank box is precisely 3,5 pt wide.

       

      To get rid of this box on the left and right side of the graphic, in Indesign CS5 (Windows),

      I have to select the frame, go to the Width box and write “- 3,5 pt” and confirm with the Enter key.

      I also have to be sure that the Reference Point is in the center position.

       

      What I need is a script that works like this: I select lines of text with the Text tool and the script

      crops the frames (not the graphics) by 3,5 pt (left and right sides only) using the central

      Reference Point as a reference.

       

      I confess that I don’t know how to script this and that my Spanish blond hair head does not work

      very well with scripts… although I have studied GREP and now there are people calling me to help

      them with GREP searches and styles (would anyone imagined this a few months ago?)

      So, as usual, can somebody help me?

       

      Thank you in advance

       

      Maria

        • 1. Re: Crop frames
          Shonkyin Level 3

          Hi Maria,

           

          Try with below code:

           

          var myDoc = app.activeDocument;
          var oldVertical = myDoc.viewPreferences.verticalMeasurementUnits;
          var oldHorizontal = myDoc.viewPreferences.horizontalMeasurementUnits;
          myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
          myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
          var myPictureBox = app.selection[0].rectangles;
          for (var a=0; a<myPictureBox.length; a++)
          {
               var oldBound = myPictureBox[a].geometricBounds;
               myPictureBox[a].geometricBounds = [oldBound[0], (oldBound[1]+1.75), oldBound[2], (oldBound[3]-1.75)];
          }
          myDoc.viewPreferences.verticalMeasurementUnits = oldVertical;
          myDoc.viewPreferences.horizontalMeasurementUnits = oldHorizontal;
          
          

           

           

          Please ensure that you have selected some text with anchored object in it.

           

          Shonky

          • 2. Re: Crop frames
            Maria964 Level 1

            Thank you very much. The script works very well. You your script I will avoid a lot of work.

             

            If you ever need anything from Portugal, just say it.

             

            Best regards,

             

            Maria