2 Replies Latest reply on Feb 27, 2016 4:29 AM by mauricior6328708

    Script that creates default tabs in the document margin.

    mauricior6328708 Level 1

      I need a script that creates guides (1 cm margins: top, left, right, down, and two more in the center, one vertical and one horizontal) independent of tamano document. Would look like this: whenever I create a new document, execute an action that rodadoria the script creating a document with the enclosed area, like the figure below: Thank you!

      http://zip.net/brsW9j

        • 1. Re: Script that creates default tabs in the document margin.
          SuperMerlin Level 5
          #target photoshop;
          if(documents.length) main();
          
          function main(){
          var strtRulerUnits = app.preferences.rulerUnits;
          var strtTypeUnits = app.preferences.typeUnits;
          app.preferences.rulerUnits = Units.PIXELS;
          app.preferences.typeUnits = TypeUnits.PIXELS;
          var cm = activeDocument.resolution/2.54;
          var W =activeDocument.width;
          var H =activeDocument.height;
          guideLine(cm,"Vrtc");
          guideLine(cm,"Hrzn");
          guideLine(W-cm,"Vrtc");
          guideLine(H-cm,"Hrzn");
          guideLine(W/2,"Vrtc");
          guideLine(H/2,"Hrzn");
          app.preferences.rulerUnits = strtRulerUnits;
          app.preferences.typeUnits = strtTypeUnits;
          }
          function guideLine(position, type){
              var desc27 = new ActionDescriptor();
                  var desc28 = new ActionDescriptor();
                  desc28.putUnitDouble( app.charIDToTypeID('Pstn'), app.charIDToTypeID('#Pxl'), position );
                  desc28.putEnumerated( app.charIDToTypeID('Ornt'), app.charIDToTypeID('Ornt'), app.charIDToTypeID(type) );
              desc27.putObject( app.charIDToTypeID('Nw  '), app.charIDToTypeID('Gd  '), desc28 );
              executeAction( app.charIDToTypeID('Mk  '), desc27, DialogModes.NO );
          };
          
          
          
          • 2. Re: Script that creates default tabs in the document margin.
            mauricior6328708 Level 1

            Wow, perfect! It was exactly the way I wanted! Thank you for script SuperMerlin