4 Replies Latest reply on May 8, 2008 6:17 PM by (Olav_Kvern)

    VBS and Graphic Lines

    Dave Pepper
      I'm trying to get a vbs script to recognize the slope (positive or negative) of a GraphicLine. When you find a line in a document and then use the GeometriBounds property to analyze where it is pointing, you can have two different lines that match the same GeometricBounds (one with positive slope and one with a negative slope). I can't find a way for the script to recognize which line you are dealing with.
        • 1. Re: VBS and Graphic Lines
          Level 1
          GeometricBounds = (y1,x1,y2,x2)

          then your line start in (x1,y1) and end in (x2,y2)
          I'm not sure - you need to check - what if you rotate/flip

          robin

          --
          www.adobescripts.com
          • 2. Re: VBS and Graphic Lines
            Dave Pepper Level 1
            The probelm is that GeometricBounds does not equal
            (y1,x1,y2,x2)
            GeometricBounds equals
            (top,left,bottom,right)

            Top does not neccessarily = y1
            Left does not neccessarily = x1

            In other words there may not neccessarily be a relationship between "Top" and "Left" because they could be on opposite ends of the line.

            And the same is true for "bottom" and "right"
            • 3. Re: VBS and Graphic Lines
              Level 1
              there is no specific info about original start and end point
              if you draw line from (0,0) to (100,100) GeometricBounds will be the same like for line (100,100)->(0,0)

              maybe play with LeftLineEnd and RightLineEnd ...

              ok - I checked this - if you draw line from (0,0) to (100,100) - LeftLineEnd is in (0,0)
              but if you draw line from (100,100) to (0,0) - LeftLineEnd is in (100,100)
              now - when you change LeftLineEnd from none to something - InDesign will change GeometricBounds :)
              so - you need to check new GeometricBounds :)

              robin

              --
              www.adobescripts.com
              • 4. Re: VBS and Graphic Lines
                Level 1
                Hi David, Robin,

                Don't bother with geometric bounds when drawing graphic lines. Instead, use the entire path property of path 1 of the graphic line. Like this:

                Rem Given a graphic line "myGraphicLine"
                myGraphicLine.Paths.Item(1).EntirePath = Array((72, 72), (144, 144))

                Once you've drawn the graphic lines, you can distinguish between them by looking at the entire path and deriving the slope from the x and y values in the array.

                Thanks,

                Ole