I'm writing a script to automate scene states. I using graphic styles to change appearance. How do I get object's graphicStyle
? Is there a way to have a collection of objects of chosen style?
1 Answer
I don't know what you make with all objects, but if you wuold select all item with same graphic style you can use app.executeMenuCommand('Find Style menu item');
script after selection active on one object with choosen style.
For example: choose 1 object and launch this script:
app.executeMenuCommand('Find Style menu item');
for(var i=0;i<app.selection.length;i++){
app.selection[i].doSomething;
}
Hope it's work for you.
length
property, or such methods asgetByName
orindex
get you close to what you need? I know that Illustrator scripting can be really frustrating and Adobe's documentation isn't all that helpful :(graphicStyles
(getByName
andindex
) is returning notgroupItem
as it is said in the documentation, butgraphicStyle
.