Page 1 of 1

groups grrrrr

Posted: Tue Jan 31, 2012 7:23 pm
by kevin11
I have some groups, named, say, A,B,C, etc, and I want to group them.
Names of the groups are in an array, eg, gnames[1], gnames[2]...

I thought I could build a string with these group names and put "group" in front of each name, eg
put "group " & quote & gnames[1] & quote & " and group & quote & gnames[2] & quote" into xxx
and then execute : group xxx

This should be the same as doing : group group "A" and group "B" and group "C"
but it fails with a "Chunk: error in object expression"

If I display xxx, it shows : group "A" and group "B" and group "C" which is what I expect.

If I hardcode it, and execute : group group "A" and group "B" and group "C", it works fine.
So it seems I'm doing something wrong in getting (group "A" and group "B" and group "C") into a string and using that string with the group command.

What am I doing wrong please ?

Thanks

Re: groups grrrrr

Posted: Tue Jan 31, 2012 7:35 pm
by Klaus
Hi Kevin,

there is another possibility to group object! Select all objects and then use the "group" command.

Try this:

Code: Select all

...
## 1. First loop thorough all KEYs of your array
repeat for each key tKey in YourGroupArrayHere

   ## Store the group name in a variable
  put YourGroupArrayHere[tKey] into tGroupName

   ## 2. Select all groups that you want to group
  set the selected of grp tGroupName to true
end repeat

## Now the command
group

## De-select everyting
select empty

## Done :-)
...
Best

Klaus

Re: groups grrrrr

Posted: Tue Jan 31, 2012 8:09 pm
by bn
Hi Kevin,

you could try:

Code: Select all

do "group" && XXX
for me it works.

Kind regards

Bernd

Re: groups grrrrr

Posted: Wed Feb 01, 2012 1:31 am
by kevin11
Thanks everybody. I implemented Klaus' method and it worked perfectly.