0 Replies Latest reply on Sep 10, 2009 5:29 PM by ostranderbrown1

    How To Center A Selection

    ostranderbrown1

      The following script works well, but instead of setting particular coordinates for the placement of my selection, I would rather center (0,0) the selection based on an anchor point. How do I accomplish this?

       

      Thank-you,

      Christopher

       

      Set myIndesign = CreateObject("Indesign.Application.2.0")

      soNumber = InputBox("Enter SO Number", "Enter SO Number")

      runNumber = InputBox("Enter Run Number", "Enter Run Number")

      mySaveLocation = ("G:\_Pre-Press\___Todays work\4ups - Done\"&runNumber&".indd")

      Set myDocument = myInDesign.Open("G:\_Pre-Press\___Todays work\"&soNumber&".indd")


      'Select All
      For x = 1 To myDocument.PageItems.Count
              myDocument.Select myDocument.PageItems.Item(x), True
              Next

      'Copy
      myIndesign.Copy

      myDocument.close (1852776480)

      Set myDocument = myInDesign.Open("G:\_Pre-Press\___Todays work\Envelope #10 Heidelberg.indt")

      myIndesign.Paste

      'Grab Selection
      Set oWindow = myIndesign.ActiveWindow
      Set oSpread = oWindow.ActiveSpread
      Set oLayer = oWindow.ActiveLayer
      Set oGroups = oSpread.Groups
      Set oGroup = oGroups.Add(oLayer, myDocument.Selection)

      oGroup.Rotate(90)
      oGroup.Move Array(-2.0625,0)

      myDocument.SaveAs(mySaveLocation)