5 Replies Latest reply on Apr 27, 2013 1:31 AM by shilpa25

    GraphicLines to Margin

    shilpa25 Level 1

      Hi Forum,

       

      I m trying to move created GraphicLines to Left MarginEdge.

       

      var myPage = app.activeDocument;

      var myGraphicLine = myPage.graphicLines.add();

       

      myGraphicLine.paths.item(0).pathPoints.item(0).anchor = [10, -10];

       

      myGraphicLine.paths.item(0).pathPoints.item(1).anchor = [10, -3];

      myGraphicLine.select();

       

       

      right = app.activeDocument.documentPreferences.pageWidth-app.activeWindow.activePage.marginPrefer ences.right;

      myPx = app.activeDocument.documentPreferences.pageWidth;

      myPy = app.activeDocument.pages[0].marginPreferences.left;

      myZy = myPy-myPx;

      app.selection[0].move[myPy, myPx];

       

       

      but  the ESTK error says (undefined, only line is added above the top of page and it is not moved to the left margin edge).

       

      Can body help on this...

        • 1. Re: GraphicLines to Margin
          Jump_Over Level 5

          Hi,

           

          You should play with

          page.bounds,

          page.marginPreferences

          and graphicLine's pathPoint.anchor.

           

          your correct myx position = page.bounds[1] + page.marginPreferences.left

           

          so set your line as:

          myGraphicLine.paths.item(0).pathPoints.item(0).anchor = [myx, -10];

          myGraphicLine.paths.item(0).pathPoints.item(1).anchor = [myx, -3];

           

          Jarek

          • 2. Re: GraphicLines to Margin
            shilpa25 Level 1

            Hey Jarek,

             

            How r u!, thanks for your reply.

             

            I though i can move it using pageedge - pagemargin.left....

             

            thanks for your correction.... What can be done, if my top of every graphicLine should falls within the Slug area, assume, the document may in any measurement....

             

            eg. just like crop marks. I want to move the graphicLine between the pagebound top and slug leaving 5mm space....

             

            thanks Jarek..... thanks much....

            • 3. Re: GraphicLines to Margin
              shilpa25 Level 1

              Hi Jarek,

               

              I can move all the sides except,

               

              after right edge of page bound + page.marginPreferences.bottom (a anchor of a horizontal line starts after right edge of page( near bottom margin ) after +3mm to 10 mm)

              • 4. Re: GraphicLines to Margin
                Jump_Over Level 5

                Hi,

                 

                myY = page.bounds[2] - page.marginPreferences.bottom;

                myX = page.bounds[3] - page.marginPreferences.right;

                myX0 = myX + 3;

                myX1 = myX + 10;

                myGraphicLine.paths.item(0).pathPoints.item(0).anchor = [myX0, myY];

                myGraphicLine.paths.item(0).pathPoints.item(1).anchor = [myX1, myY];

                 

                Jarek

                • 5. Re: GraphicLines to Margin
                  shilpa25 Level 1

                  fantastic Jarek!...

                   

                  thanks so much....

                   

                  you are genius! It helps me to do like this..

                   

                  var myGraphicLine = page.graphicLines.add();

                  myGraphicLine.paths.item(0).pathPoints.item(1).anchor = [page.bounds[0]  + page.marginPreferences.left, page.bounds[2] + 10];

                   

                   

                  thanks so much Jarek.....