on mouseUp
repeat with y = 1 to the number of grps -- and/or controls
put the name of grp y && "and " after temp
end repeat
delete the last word of temp
do "select" && temp
do "group" && temp
end mouseUp

You might put a conditional in front of the "put" line to filter the objects you want:

But now looking at the dictionary, I see that there is yet another way, to use an "objectList" as the list of groups or controls to, er, group. This objectList seems to be an array, and I am not sure how it is constructed. Someone else will chime in, though.

But can i ask you why everytime i move the location of my box, when it hit the maximum height it will auto go to the middle??

Example : my first box will move to 150,200 location then second box will move to 150,400 then my third box will move to 150,600. But my fourth box and fifth box will auto go to the 150,165 .... (i'm using repeat coding for the moving of box)

Any idea i can go let them go 150,800 then 150,1000 and continue..... then after that i can use my script to group down and allow scrolling??