2 Replies Latest reply on Sep 24, 2014 6:16 AM by djbgraphicdesign

    Resizing selected objects

    djbgraphicdesign Level 1

      Ok, so I am trying to write a script that resizes an object that is selected. I have two objects selected, the one on top is a group item, the one below it is a rectangle. I am trying to resize the rectangle to the size of the group item on top of it with a little margin around it. Here is what I have so far.

       

      var design = app.activeDocument.selection[0];


           var top=design.visibleBounds[1]+5*2; 

           var left=design.visibleBounds[0]-5*2; 

           var width=design.visibleBounds[2]-design.visibleBounds[0]+10*2;

           var height=design.visibleBounds[1]-design.visibleBounds[3]+10*2;

       

       

      var background = app.activeDocument.selection[1];

      background.position = (top, left, width, height);

       

      The problem is the last line there. I'm not sure how to manipulate the position/size of the selected object or if it is even possible I have searched for it and haven not found an answer. Thanks in advance!