Sg2.9
[JScript] How i can counting...
Recent RSS
[JScript] How i can counting gradient key's in filled object
From:  Brumel
Date:  28. April 2012, 09:14

(sorry for my bad english)

I have a problem. in the script loop through all objects in the document, was producing some manipulation. so, please tell me how to count the number of nodes (or stops) in the gradient and mesh fills?

I try to use (docRef.pageItems[i].fillColor.gradientStops.length) and the like, but AI write me - (error) undefine.

Re: [JScript] How i can counting gradient key's in filled object
From:  Bob138
Date:  12. September 2014, 21:29

Seeing as only pathItems can have a gradient applied to them it's easier to just check the doc.pathItems

var docRef = app.activeDocument;
for (i=0;i<docRef.pathItems.length;i++)
{
if (docRef.pathItems[i].fillColor.typename == "GradientColor")
{
alert(docRef.pathItems[i].fillColor.gradient.gradientStops.length);
}
}

Bob

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Roulettes 18.04.10