Page 1 of 1

Group objects already grouped and set name of group

Posted: Tue Sep 16, 2014 8:01 pm
by matgarage
Hello,

I'm trying to name a group of other groups by script

I set leGroupe as a list of groups to group.
And this script to do that.

Code: Select all

repeat for each line ligne in leGroupe
        set the selected of ligne to true
   end repeat
   group
    set the name of  last group to "GroupeName"
But in this case last group return the last group of graphic (child) of the last group in the list leGroupe (parent), but not the parent group.

I can't find how to rename this group of selected objects.

Someone can help me ?

matgarage

Re: Group objects already grouped and set name of group

Posted: Tue Sep 16, 2014 8:50 pm
by bn
Hi Matgarage,

last group will often not work as you found out. The reason is that last is determined by layer. But the layer of a group of groups is the lowest layer of those groups.

I would use a work around that makes use of the fact that when you know the groups your are grouping those groups will be "owned" by your super group "groupeName"

Code: Select all

   repeat for each line ligne in leGroupe
      set the selected of ligne to true
   end repeat
   group
   set the name of the owner of (line 1 of leGroupe)  to "GroupeName"
you simply ask for the owner of one of the groups that are now grouped and rename the owner.

Kind regards

Bernd

Re: Group objects already grouped and set name of group

Posted: Tue Sep 16, 2014 9:01 pm
by matgarage
Yes ! It's working.
Bernrd, this simple concept will boost my future coding strategies .
Thank you .

Matthieu