Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get to know which one is active Stroke or Fill for the document.

Contributor ,
May 09, 2012 May 09, 2012

Is there any way to find out which one, between stroke or fill, is active for a particular document using illustrator scripting?

I have to apply color on the selected object accordingly.
If fill is active then i use obj.fill.color = 0xff00ff; and,

if stroke is active then i use obj.stroke.color = 0xff00ff;

But i am not able to find which one is active..

Any help would be appreciated...

Thanx...

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
May 09, 2012 May 09, 2012

I think as far as script is concerned the object is selected from that you can access and change either… Only the GUI has the change either fill/stroke by making it foremost… oh and the swapper

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 10, 2012 May 10, 2012

Thanx for the reply...
I am able to get the selected object but how can i access stroke/fill to find out which one is foremost.
I have to just find out which one is active.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 10, 2012 May 10, 2012

You can check the properties filled and stroked to see if the object has either, both or none… No such thing as foremost… If you are talking about the stacking of the appearance palette then you have NO access to that…

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 10, 2012 May 10, 2012

Thanx Mark...
I had used these properties filled and stroked but it doesnt give me what i want...
Here is the sample code:

pathArt = new PathItem();

if(pathArt.selected)

{

   

     if(pathArt.filled == true)

          pathArt.fillColor = colorValue;

                       

      else if(pathArt.stroked == true)

          pathArt.strokeColor = colorValue;

}

value of both pathArt.filled and pathArt.stroked are true, it didnt tell me which one(stroke/fill) is active.

Anyways thanx for ur help i'll find any work around....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 04, 2024 May 04, 2024
LATEST

I've found this thread in 2024. This is what works in Illustrator 28.4.1:

var isStroke = app.isStrokeActive() ? true : false;
if(isStroke){
  var tmpObj = doc.defaultStrokeColor;
}else{
  var tmpObj = doc.defaultFillColor;
}
alert([tmpObj.red, tmpObj.green, tmpObj.blue,].join(', '));
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines