Skip navigation
Joce Nunes BR
Currently Being Moderated

Color Names

Sep 6, 2012 4:59 AM

Hello everyone,

 

I would like know, if this is possible,  for example, I Create a square with size 10mm X 10mm and next to square a script that writing the name of color that i used that object.

 

How bellow in the red area:

 

 

Captura de Tela 2012-09-06 às 08.59.01.png

 

 

Good, thanks

 

Joce

 
Replies
  • Currently Being Moderated
    Sep 6, 2012 10:53 PM   in reply to Joce Nunes BR

    the following script works only if your swatches are "Spots"

    labelColorUsed.PNG

     

    select your little squares before running

     

    var fontSize = 20;
    var spacing = 6;
     
     
    var idoc = app.activeDocument;
    var sel = idoc.selection;
     
     
    for (j=0; j<sel.length; j++) {
        var ipath = sel[j];
        var itext = idoc.textFrames.add();
              try {
                        var icolor = ipath.fillColor;
                        itext.contents = icolor.spot.name;
              }
              catch (e){
                        itext.contents = 'Convert to Spot';
              }
     
     
              itext.textRange.characterAttributes.size = fontSize;
              itext.left = ipath.left + ipath.width + spacing;
              itext.top = ipath.top - ipath.height/2+ itext.height/2;
    }
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points