11 Replies Latest reply on Apr 21, 2014 9:30 PM by Unique

    Find cyan value

    Unique Level 1

      Hi forum,

       

      I need a great help from you.

       

      There are number of filled items on a page.

       

      And i do want to get Alert,  the value of Cyan inside a swatch.

       

      Any possible to get this.

       

      thanks...forum....

        • 1. Re: Find cyan value
          Mi_D Level 3

          Hi

          try this

           

          var myDoc = app.activeDocument;

          var myPage = myDoc.pages;

          for (var p=0; myPage.length>p; p++){

              var myItem = myPage[p].pageItems.everyItem().getElements();

              for (var i=0; myItem.length>i; i++){

                  try{

                  var cyen = myItem[i].fillColor;

                  alert(cyen.colorValue[0])

                      }

                  catch(e)

                  {e}

                  }

              }

           

          Mi_D

          • 2. Re: Find cyan value
            Kai Rübsamen Adobe Community Professional

            Hi,

             

            I would think, that the current element should be selected, if the value is displayed and that there is no need to display a value of "0" ?

             

            And: Mi_Ds and my snippet does not find strokes, fill color in table cells and fill color in text at the moment.

             

             

            var doc = app.activeDocument;
            var allPItems = doc.allPageItems;
            
                for ( var i = 0; i < allPItems.length; i++ ) {
                    var curItem = allPItems[i];
                    if ( curItem != "[object Group]" ) {
                        if ( curItem.fillColor.name != "None" ) {
                            var fColor = curItem.fillColor;
                            var cyan = fColor.colorValue[0];
                            if ( cyan != 0 ) {
                                curItem.select();
                                alert( "Selected object has a cyan value of: " + cyan );
                            } // if
                        } // if
                    } // if
                } // for
            
            • 3. Re: Find cyan value
              Unique Level 1

              Hi

              MI_D &&

               

              2. Kai Rübsamen,

               

              Many thanks for the support.

               

              One more support needed to get alert of the coors.

               

              How to find the spot color, with the Color mode as CMYK.

               

              Please see the find attachement for better understanding.Screen Shot 2014-04-16 at 17.52.51.png

               

              Many thanks for the support.

              • 4. Re: Find cyan value
                pixxxel schubser Level 5

                Hi Unique,

                Unique wrote:

                … needed to get alert of the coors.

                 

                How to find the spot color …

                what is a „coors“ ?

                 

                If you looking for the color value of your UNIQUE COLOR swatch, you can do something like this:

                 

                var aDoc = app.activeDocument;
                var aSwatch = aDoc.swatches.itemByName('UNIQUE COLOR');
                alert(aSwatch.colorValue);
                

                 

                (Info: Be sure, that a swatch with this name exists.)

                 

                Have fun

                 

                • 5. Re: Find cyan value
                  Mi_D Level 3

                  Hi

                   

                  To find color type color mode like that

                   

                   

                  var myDoc = app.activeDocument;

                  var myPage = myDoc.pages;

                  for (var p=0; myPage.length>p; p++){

                      var myItem = myPage[p].pageItems.everyItem().getElements();

                      for (var i=0; myItem.length>i; i++){

                          try{

                          var cyen = myItem[i].fillColor;

                          if (myItem[i].fillColor.model == ColorModel.SPOT && myItem[i].fillColor.space )

                          alert(myItem[i].fillColor.name )

                          }

                          catch(e)

                          {alert(e)}

                          }

                      }

                   

                   

                  Mi_D

                  • 6. Re: Find cyan value
                    Unique Level 1

                    Hi Mi_D,

                     

                    Im sorry for the delayed response, since i was in my annual leave.

                     

                    Mi_D!...thanks for your reply,... & only one clarifications..

                     

                    when there is any rectangle box filled with  None & stroke applied. or fill or stroke both "None".

                     

                    the above script show error..

                     

                    i tried to mention in script like this but no result..

                     

                    if (myItem[i].fillColor.model == ColorModel.NONE && myItem[i].fillColor.space )

                     

                    any help on this..

                    • 7. Re: Find cyan value
                      Unique Level 1

                      none.png

                       

                      please see the above snapshot.....

                       

                      while running the above script.... it doesnt find the objects with Fill Color NONE & stroke color applied or not....

                      • 8. Re: Find cyan value
                        Mi_D Level 3

                        HI

                        try this

                         

                        var myDoc = app.activeDocument;

                        var myPage = myDoc.pages;

                        for (var p=0; myPage.length>p; p++){

                            var myItem = myPage[p].pageItems.everyItem().getElements();

                            for (var i=0; myItem.length>i; i++){

                                var cyen = myItem[i].fillColor;

                                if (myItem[i].fillColor.name!="None"){

                                if ((myItem[i].fillColor.model == ColorModel.SPOT) && (myItem[i].fillColor.space) )

                                alert(myItem[i].fillColor.name )

                                }

                         

                         

                            }

                        }

                         

                        Mi_D

                        • 9. Re: Find cyan value
                          Unique Level 1

                          Thank you so much for your support Mi_D.

                           

                          I would really like to appreciate the tendency of helping....

                           

                          I would like to give a point and close the thread...

                           

                          Would like to post a new question regarding this...

                           

                          Many thanks Mi_D...

                          • 10. Re: Find cyan value
                            Unique Level 1

                            Thank you so much for your support Mi_D.

                             

                            I would really like to appreciate the tendency of helping....

                             

                            I would like to give a point and close the thread...

                             

                            Would like to post a new question regarding this...

                             

                            Many thanks Mi_D...

                            • 11. Re: Find cyan value
                              Unique Level 1

                              Thank you so much for your support Mi_D.

                               

                              I would really like to appreciate the tendency of helping....

                               

                              I would like to give a point and close the thread...

                               

                              Would like to post a new question regarding this...

                               

                              Many thanks Mi_D...