Skip to main content
Participating Frequently
February 28, 2012
Answered

Get swatch name for character

  • February 28, 2012
  • 1 reply
  • 697 views

Hello,

I'm needing to loop through each character of a text frame and check the color of each character.  Is it possible to get the swatch name of each character?  Or can you only get the red, green, blue values?

I've been experimenting with:

app.activeDocument.textFrames[0].characters[3].characterAttributes.fillColor.typename;

// Returns SpotColor

But I can't figure out how to get the swatch name of the character this way?

Thanks.

Jay

This topic has been closed for replies.
Correct answer CarlosCanto

spot colors have a property to get the name

alert(app.activeDocument.textFrames[0].characters[3].characterAttributes.fillColor.spot.name);

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
February 28, 2012

spot colors have a property to get the name

alert(app.activeDocument.textFrames[0].characters[3].characterAttributes.fillColor.spot.name);

j2112jAuthor
Participating Frequently
February 29, 2012

Thank you, CarlosCanto!  This was exactly what I needed!  :-)

Jay