2 Replies Latest reply on Apr 11, 2008 3:50 PM by (Archie_Tucker)

    All option for selection command

      Once you have selected multiple items how do you move them as one? I have looked thru the sample scripts, Adobe PDF's and the user postings without any luck. Below is the sample script with the line - myInDesign.Selection.item(1).move Array(5, 5) that I have the question on. This line only moves the first selection and not all.
      Thanks,
      Archie

      For I = 1 to myDocument.PageItems.Count
      X1=17
      Y1=18
      X2=47
      Y2=33

      myItemType = TypeName(myDocument.PageItems.Item(I))
      REM MsgBox "Counter: " & cStr(I) & " Type: " & myItemType

      Set myCurrentObject = myDocument.PageItems.Item(I)

      myBounds = myCurrentObject.GeometricBounds
      myY1 = myBounds(0)
      myX1 = myBounds(1)
      myY2 = myBounds(2)
      myX2 = myBounds(3)

      If myX1 >= X1 - 1 and myY1 >= Y1 - 1 and myX2 <= X2 + 1 and myY2 <= Y2 + 1 Then
      myGroupCounter = myGroupCounter + 1
      MyDocument.Select myCurrentObject, idSelectionOptions.idAddTo
      End If

      Next

      If myGroupCounter > 0 Then
      ** this line ** myInDesign.Selection.item(1).move Array(5, 5)
      End If
        • 1. Re: All option for selection command
          Level 1
          why you don't move objects instead of selecting ??
          or if you need to select them for feature tasks - select and move or move and select ;)

          robin

          --
          www.adobescripts.com
          • 2. Re: All option for selection command
            Level 1
            I need to select all objects in the area (could be text, plus a border, or text plus graphic lines, or text with a image, etc.) that makes up the stamp, move that selection of objects to another document, then reduce it to fit on a die cut label. This script is for a document that contains 8 stamps per page. I think I have it working now. Below is the section of code I have been using to test this.
            Thanks,
            Archie

            Rem GROUP
            Rem -----
            Function myGroup (myInDesign, myDocument)

            myLabelPercent = .73
            For I = 1 to myDocument.PageItems.Count
            X1=17
            Y1=18
            X2=47
            Y2=33

            myItemType = TypeName(myDocument.PageItems.Item(I))

            Set myCurrentObject = myDocument.PageItems.Item(I)

            myBounds = myCurrentObject.GeometricBounds
            myY1 = myBounds(0)
            myX1 = myBounds(1)
            myY2 = myBounds(2)
            myX2 = myBounds(3)

            If myX1 >= X1 - 1 and myY1 >= Y1 - 1 and myX2 <= X2 + 1 and myY2 <= Y2 + 1 Then
            myGroupCounter = myGroupCounter + 1
            MyDocument.Select myCurrentObject, idSelectionOptions.idAddTo
            End If

            Next

            If myGroupCounter > 0 Then
            Set myGroup = myDocument.Groups.Add(myDocument.Selection)
            myGroup.move Array (10, 10)
            set myScaleMatrix = myInDesign.TransformationMatrices.Add(cDbl(myLabelPercent), cDbl(myLabelPercent))
            myGroup.Transform idCoordinateSpaces.idPasteboardCoordinates,idAnchorPoint.idCenterAnchor,

            myScaleMatrix
            MyDocument.Select idNothingEnum.idNothing
            End If

            End Function