Copy link to clipboard
Copied
Hello the Community,
I'm looking for an easy way in VBScript to change the colour of each pathitems in a group even they are included in sub-group or a sub-sub-group etc... until the deeper level.
For a single level of groupitems this script works well :
Set mycolor = docref.swatches(10)
set mygroup = docref.groupitems("MyGroup")
for each piece in mygroup.pathitems
piece.fillcolor = mycolor.color
next
The question is how to include a loop inside each level of sub-groupitems.
Thanks for your help
Bruno
you need to use a "recursive" function (a function that calls itself). Search the forum we have posted plenty of samples. Most likely all you'll see will be in Javascript, but study the concept and adapt it to vbs. If you get stuck, post back and we'll help you.
the other options is to select the group and apply a color to the whole group as if you're clicking on a swatch in the UI.
to do that, select your object then apply a color using the defaultFillColor property
app.activeDocument.def
...
Copy link to clipboard
Copied
you need to use a "recursive" function (a function that calls itself). Search the forum we have posted plenty of samples. Most likely all you'll see will be in Javascript, but study the concept and adapt it to vbs. If you get stuck, post back and we'll help you.
the other options is to select the group and apply a color to the whole group as if you're clicking on a swatch in the UI.
to do that, select your object then apply a color using the defaultFillColor property
app.activeDocument.defaultFillColor = color;
that's javascript but you get the idea.