3 Replies Latest reply on Mar 21, 2011 5:23 AM by siva k

    Easy one?

    tpstom-UAs6T9

      Hey guys

       

      A while ago a very kind person supplied me with a simple script for creating a standard set of layers every time I open a new ID doc. This has been fantastic.

       

      Every time I open a new ID doc I go through the same process. Execute my layers script and then add borders to my doc. So I wondered if it was possible to create a script that did the following:

       

      1. Create frame the size of the document bleed. Fill with white.

      2. Create frame the size of the page.

      3. Punch the page frame out of the bleed frame.

      4. Create a final frame the size of the page. Assign 0.5 black border.

       

      Is that possible? Is it hard?

       

      Thanks in advance for any help.

       

      Tom

        • 1. Re: Easy one?
          [Jongware] Most Valuable Participant

          Going over the ESTK help, I see "Bleed" is a document preference thing; and everything else seems to be in there as well, including document size. The rectangle stuff is all standard drawing and assigning attributes.

           

           

          docwide = app.activeDocument.documentPreferences.pageWidth;
          dochigh = app.activeDocument.documentPreferences.pageHeight;
          // 1. A rect of bleed size
          bleedrect = app.activeDocument.rectangles.add();
          // [ topy leftx bottomy rightx ]
          bleedrect.geometricBounds = [ - app.activeDocument.documentPreferences.documentBleedTopOffset,
           - app.activeDocument.documentPreferences.documentBleedInsideOrLeftOffset,
           dochigh + app.activeDocument.documentPreferences.documentBleedBottomOffset,
           docwide + app.activeDocument.documentPreferences.documentBleedOutsideOrRightOffset ];
          // Fill with white:
          bleedrect.fillColor = app.activeDocument.swatches.itemByName("Paper");
          // Ensure no stroke! (It might be on by default)
          bleedrect.strokeWeight = 0;
          // 2. Repeat for page size
          pagerect = app.activeDocument.rectangles.add();
          pagerect.geometricBounds = [ 0,
           0,
           dochigh,
           docwide ];
          // 3. Punch out. (That's called 'minusBack')
          // The function needs an array, so we create one on the fly containing just the bleedrect.
          // (And I needed to test what should be on the left and what on the right side of the function call...)
          pagerect.minusBack( [ bleedrect ] );
          // 4. Another page rect with attributes
          pagerect = app.activeDocument.rectangles.add();
          pagerect.geometricBounds = [ 0,
           0,
           dochigh,
           docwide ];
          // This time, ensure no fill.
          pagerect.fillColor = app.activeDocument.swatches.itemByName("None");
          // Other attributes:
          pagerect.strokeWeight = 0.5;
          pagerect.strokeColor = app.activeDocument.swatches.itemByName("Black");
          
          • 2. Re: Easy one?
            tpstom-UAs6T9 Level 1

            Jongware

             

            Holy crap mate. Thanks so much!

             

            That is absolutely awesome. You are a star.

             

            Tom

            • 3. Re: Easy one?
              siva k Level 1

               

               

               

              Hello Jongware,

               

              Thanks for your script it’s working pretty well. You did a great job. Can you add to your script that 2 boxes will be in under the all objects so can run this script with other scripts.


              EX:  I have placed a pdf file in InDesign than I will run some other scripts. (I have also added your scripts with other scripts but it’s creating white box above the pdf file.) I need under the pdf or below the all objects. I tried for that but now working …
              Please help me.


              One more question Fonts to outlines is possible with script?

               

              Thanks in advance

               

               

              Regards,

              Siva