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

VBScript Loop in Groupitems and their sub-groups

New Here ,
Dec 09, 2020 Dec 09, 2020

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

TOPICS
Scripting

Views

167

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Dec 09, 2020 Dec 09, 2020

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
...

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 09, 2020 Dec 09, 2020

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

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