1 Reply Latest reply on Aug 16, 2009 2:36 AM by Kasyan Servetsky

    [CS2] [JS] Resize anchored object...

    Theresa V. Level 1

      Good morning:

       

      I need help figuring out how to resize different objects that are anchored in text. They do have a script label on them.
      For example I have an inline text box with the script label "gadget" that needs to be resized from 1 inch to 2 inches.
      Is there away to do this by way of a script?

       

      Thanks in advance!

       

      Theresa

        • 1. Re: [CS2] [JS] Resize anchored object...
          Kasyan Servetsky Level 5

                                             

          Hi Teresa,

           

          This is a very basic example: it adds 1 inch to the width and height of the inline text frame with "gadget" label (I assume that it may occur only once in each story and measurements are set to inches). I wrote this on CS3 — don't have CS2 any more.

           

          var myDoc = app.activeDocument;
          var myStories = myDoc.stories;
          for (i = 0; i < myStories.length; i++) {
              var myTextFrame = myStories[i].textFrames.item("gadget");
                  if (myTextFrame != null) {
                  var myGb = myTextFrame.geometricBounds;
                  var myNewGb = [myGb[0], myGb[1], myGb[2]+1, myGb[3]+1];
                  myTextFrame.geometricBounds = myNewGb;
              }
          }

           

           

          Kasyan