0 Replies Latest reply on Apr 27, 2011 6:23 PM by John Galvin

    Moving a rectangle - [CS2 VB Script]

    John Galvin

      Hi

       

      I'm writing a scatter proof programme and I have no problem importing the graphics into separate graphic frames. The problem happens

      when I attempt to move each frame into position.

       

      I'm using this code:

       

              For myCounter = 1 To UBound(myFileList) + 1
                  myFile = myFileList(myCounter - 1)
                  Set myPage = myPages.Item(PageCount)
                  Set myRectangle = myPage.Rectangles.Add
                  myRectangle.GeometricBounds = Array(0, 0, 40, 40)
                  myRectangle.strokeWeight = 0
                  myRectangle.strokeColor = myDocument.Swatches.Item("None")
                  myRectangle.place myFile
                  myRectangle.Label
                  myRectangle.fit idFitOptions.idFrameToContent

                  Y1 = myRectangle.GeometricBounds(0)
                  X1 = myRectangle.GeometricBounds(1)
                  Y2 = myRectangle.GeometricBounds(2)
                  X2 = myRectangle.GeometricBounds(3)

           myRectangle.GeometricBounds = Array (Y1 + 20, X1 + 20, Y2 + 20, X2 + 20)
                  myRectangle.fit idFitOptions.idFrameToContent
             Next

       

      If I don't use the second FrameToContent (the one before Next), the result is that the frame is moved but the graphic ends up zoomed

      down to about 50% of normal size.

      Putting in the second FrameToContent results in the graphic coming out the correct size, but the graphic frame doesn't move and remains

      in the top left corner of the screen.

       

      Is there a better way to move a graphic frame?

       

      TIA

       

      [Addendum] What appears to be happening is that the graphic frame moves, but the graphic stays in its original position. I want to move the graphic frame and move the contents by the same amount. Message was edited by: John Galvin