7 Replies Latest reply on Sep 10, 2014 11:16 PM by Sajeev Sridharan

    this script adding (here // ?)

    hamdifem Level 1

      this script adding (here // ?) font size all large letters  bold or italic   app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters;     app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters;     app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN; app.activeDocument.zeroPoint = [0,0];  var myDoc = app.activeDocument; var xAxis, yAxis, pageNo;  function cmyk(t, c, m, y, k) {     return function() {         var myColor;          myColor = app.activeDocument.colors.item(t);         if(!myColor || !myColor.isValid) {             myColor = app.activeDocument.colors.add();             myColor.properties = {name:t, model: ColorModel.PROCESS, space: ColorSpace.CMYK ,colorValue: [c, m, y, k]};         } else {            if(c != undefined &&  (myColor.properties.colorValue[0] != c || myColor.properties.colorValue[1] != m || myColor.properties.colorValue[2] != y || myColor.properties.colorValue[3] !=k)) {                 myColor.properties.space = ColorSpace.CMYK;                 myColor.colorValue = [c, m, y, k];              //   alert("Renk \""+t+"\" değiştirildi.  C = "+ c + " ; M = " + m + " ; Y = "+ y + " ; K = " + k );             }         }         return myColor;     }; }   var diyalogWindow = app.dialogs.add({name: "Rectangle or Textframe"}); with(diyalogWindow){   with(dialogColumns.add()){         with(borderPanels.add()){             with(dialogColumns.add()) {                 staticTexts.add({staticLabel:"Find W"});                 findW = textEditboxes.add({editContents: "130"});             }             with(dialogColumns.add()) {                 staticTexts.add({staticLabel:"Change W"});                 changeX = textEditboxes.add({editContents: "120"});             }          with(dialogColumns.add()) {             staticTexts.add({staticLabel:"Move X"});             moveX = textEditboxes.add({editContents: "65"});         }      }         with(borderPanels.add()){             with(dialogColumns.add()) {                 staticTexts.add({staticLabel:"Find H"});                 findH = textEditboxes.add({editContents: "10"});             }             with(dialogColumns.add()) {                 staticTexts.add({staticLabel:"Change H"});                 changeY = textEditboxes.add({editContents: "6"});             }          with(dialogColumns.add()) {             staticTexts.add({staticLabel:"Move Y"});             moveY = textEditboxes.add({editContents: "20"});         }      }    } }   if(diyalogWindow.show() == 1) {     var j;     for (var p = 0; p < app.activeDocument.allPageItems.length; p++)     {         var pageItem = document.allPageItems[p];         pageItem.select();         var frameSize = pageItem.geometricBounds;         var frameWidth = frameSize[3]-frameSize[1];         var frameHeight = frameSize[2]-frameSize[0];          if(Number(Math.round(frameWidth)) == findW.editContents && Number(Math.round(frameHeight)) == findH.editContents)         {             pageItem.geometricBounds = [frameSize[0], frameSize[1], frameSize[0] - Number(changeY.editContents), frameSize[1] + Number(changeX.editContents)];             pageItem.move([moveX.editContents, moveY.editContents]);                          for(j = 0; j < pageItem.paragraphs.length; ++j) {                     pageItem.paragraphs[j].fillColor = cmyk("TEST", 100, 0, 0, 0)();                     pageItem.paragraphs[j].appliedFont = "Swis721 Cn BT";                     pageItem.paragraphs[j].justification = Justification.RIGHT_ALIGN;                      //?                     //?                     //?                     //?                     //?                                  }                                    }     } }  alert("Done!!!");

        • 1. Re: this script adding (here // ?)
          [Jongware] Most Valuable Participant

          I don't get it. What is the question?

          • 2. Re: this script adding (here // ?)
            hamdifem Level 1

            app.activeDocument.viewPreferences.horizontalMeasurementUnits =

            MeasurementUnits.millimeters;

            app.activeDocument.viewPreferences.verticalMeasurementUnits =

            MeasurementUnits.millimeters;

            app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

            app.activeDocument.zeroPoint = ;

             

            var myDoc = app.activeDocument;

            var xAxis, yAxis, pageNo;

             

            function cmyk(t, c, m, y, k) {

                return function() {

                    var myColor;

             

                    myColor = app.activeDocument.colors.item(t);

                    if(!myColor || !myColor.isValid) {

                        myColor = app.activeDocument.colors.add();

                        myColor.properties = {name:t, model: ColorModel.PROCESS, space:

            ColorSpace.CMYK ,colorValue: };

                    } else {

                       if(c != undefined &&  (myColor.properties.colorValue[0] != c ||

            myColor.properties.colorValue[1] != m || myColor.properties.colorValue[2]

            != y || myColor.properties.colorValue[3] !=k)) {

                            myColor.properties.space = ColorSpace.CMYK;

                            myColor.colorValue = ;

                         //   alert("Renk \""t"\" değiştirildi.  C = "+ c + " ; M = "

            + m + " ; Y = "+ y + " ; K = " + k );

                        }

                    }

                    return myColor;

                };

            }

             

             

            var diyalogWindow = app.dialogs.add();

            with(diyalogWindow){

              with(dialogColumns.add()){

                    with(borderPanels.add()){

                        with(dialogColumns.add()) {

                            staticTexts.add({staticLabel:"Find W"});

                            findW = textEditboxes.add();

                        }

                        with(dialogColumns.add()) {

                            staticTexts.add({staticLabel:"Change W"});

                            changeX = textEditboxes.add();

                        }

                     with(dialogColumns.add()) {

                        staticTexts.add({staticLabel:"Move X"});

                        moveX = textEditboxes.add();

                    }

                 }

                    with(borderPanels.add()){

                        with(dialogColumns.add()) {

                            staticTexts.add({staticLabel:"Find H"});

                            findH = textEditboxes.add();

                        }

                        with(dialogColumns.add()) {

                            staticTexts.add({staticLabel:"Change H"});

                            changeY = textEditboxes.add();

                        }

                     with(dialogColumns.add()) {

                        staticTexts.add({staticLabel:"Move Y"});

                        moveY = textEditboxes.add();

                    }

                 }

               }

            }

             

            if(diyalogWindow.show() == 1)

            {

                var j;

                for (var p = 0; p < app.activeDocument.allPageItems.length; p++)

                {

                    var pageItem = document.allPageItems[p];

                    pageItem.select();

                    var frameSize = pageItem.geometricBounds;

                    var frameWidth = frameSize[3]-frameSize[1];

                    var frameHeight = frameSize[2]-frameSize[0];

             

                    if(Number(Math.round(frameWidth)) == findW.editContents &&

            Number(Math.round(frameHeight)) == findH.editContents)

                    {

                        pageItem.geometricBounds = [frameSize[0], frameSize[1],

            frameSize[0] - Number(changeY.editContents), frameSize[1] +

            Number(changeX.editContents)];

                        pageItem.move();

             

                        for(j = 0; j < pageItem.paragraphs.length; ++j) {

                                pageItem.paragraphs[j].fillColor = cmyk("TEST", 100, 0,

            0, 0)();

                                pageItem.paragraphs[j].appliedFont = "Swis721 Cn BT";

                                pageItem.paragraphs[j].justification =

            Justification.RIGHT_ALIGN;

                                //?

                                //?

                                //?

                                //?

                                //?

                        }

                    }

                }

            }

            alert("Done!!!");

             

             

             

            /*

            this here

            //?

                                //?  join  fontsize

                                //?  join  all large letters  or   all lowercase letters

                                //?  join  bold and italic

                                //?  join  fill color Textbox

             

            */

             

             

            2014-09-10 11:33 GMT+03:00  <forums_noreply@adobe.com>:

             

                this script adding (here // ?)  created by

            <https://forums.adobe.com/people/%5BJongware%5D> in InDesign Scripting

            - View the full discussion

            <https://forums.adobe.com/message/6716621#6716621>

             

            • 3. Re: Re: this script adding (here // ?)
              Sajeev Sridharan Level 4

                              //?  join  fontsize

                                  //?  join  all large letters  or   all lowercase letters

                                  //?  join  bold and italic

                                  //?  join  fill color Textbox

               

              //Font Size

              pageItem.paragraphs[j].pointSize = 10;

               

              //Capital Letter

              app.selection[0].paragraphs[0].capitalization = Capitalization.ALL_CAPS;

               

              //Capital letters to lower case letters

              pageItem.paragraphs[j].changecase(ChangecaseMode.uppercase);

               

              //Fill Color

              pageItem.paragraphs[j].fillColor= "Swatch_Name";//Mention your swatch name here


              //Bold and Italic

              pageItem.paragraphs[j].fontStyle = "Italic";

              pageItem.paragraphs[j].fontStyle = "Bold";


              //Font Family and Font Style

              pageItem.paragraphs[j].appliedFont = "Minion Pro\tItalic";

               

              Check the below link for further clarification:

               

              Adobe InDesign CS5.5 (7.5) Object Model JS: CharacterStyle

              Adobe InDesign CS5.5 (7.5) Object Model JS: ParagraphStyle

               

              Vandy


              • 4. Re: this script adding (here // ?)
                hamdifem Level 1

                thank you

                 

                I want make, align stroke to inside

                 

                pageItem.StrokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT;

                 

                its does'nt run

                 

                I am grateful to you

                 

                2014-09-10 13:29 GMT+03:00 vandy88 <forums_noreply@adobe.com>:

                 

                    Re: this script adding (here // ?)  created by vandy88

                <https://forums.adobe.com/people/vandy88> in InDesign Scripting - View

                the full discussion <https://forums.adobe.com/message/6716902#6716902>

                 

                • 5. Re: this script adding (here // ?)
                  TᴀW Adobe Community Professional & MVP

                  That should probably be:

                   

                  pageItem.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT

                   

                  that is, a small "s" at the beginning of the first strokeAlignment

                  • 6. Re: this script adding (here // ?)
                    hamdifem Level 1

                    pageItem.strokeWeight = 2;         // it's run

                    pageItem.strokeAlignment = strokeAlignment.INSIDE_ALIGNMENT;    // don't run

                    pageItem.strokeColor = cmyk("TEST4", 0, 10, 20, 30)();            // it's

                    run

                     

                    2014-09-10 23:03 GMT+03:00  <forums_noreply@adobe.com>:

                     

                        this script adding (here // ?)  created by

                    <https://forums.adobe.com/people/%5BAriel%5D> in InDesign Scripting - View

                    the full discussion <https://forums.adobe.com/message/6718900#6718900>

                     

                    • 7. Re: this script adding (here // ?)
                      Sajeev Sridharan Level 4

                      pageItem.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT;