Skip to main content
Known Participant
July 5, 2011
Question

How to find out the textframe contains "stroke color" (or) "fillcolor"?

  • July 5, 2011
  • 1 reply
  • 2413 views

How to find out the textframe contains "stroke color" (or) "fillcolor" via javascript. Kindly advise me with sample.

This topic has been closed for replies.

1 reply

CarlosCanto
Community Expert
Community Expert
July 5, 2011

Hi Maria, try this

var idoc = app.activeDocument;
var itext = idoc.textFrames[0];
//alert(itext.textRange.characterAttributes.fillColor);
var fillColor = itext.textRange.characterAttributes.fillColor;
var strokeColor = itext.textRange.characterAttributes.strokeColor;
filled = stroked = "yes";
if (fillColor=="[NoColor]")
        filled = "No";
if (strokeColor=="[NoColor]")
        stroked = "No";
alert("Filled: " + filled + "\n" + "Stroked: " + stroked);
Inspiring
July 6, 2011

Maria, if you are talking about the path of an 'area text frame' then you need to look at it's 'text path' to read the properties of that… Eg

#target illustrator var doc = app.activeDocument; var tFrame = doc.textFrames[0]; if (tFrame.textPath.filled) {            alert( 'Text Frame is filled with ' + tFrame.textPath.fillColor.typename );       }; if (tFrame.textPath.stroked) {      alert( 'Text Frame is stroked with ' + tFrame.textPath.strokeColor.typename );       };