Answered
rob dayCorrect answer
Community Expert
Oct 9, 2025 11:12 PM UTC
How do I determine that it's part of the group?
If you can assume the selection has only 2 objects (?), a group and a recatangle:
var s = app.activeDocument.selection
var ob, gb;
for (var i = 0; i < s.length; i++){
if (s[i].constructor.name != "Group") {
//the group’s bounds
ob = s[i].geometricBounds
} else {
//the page item outside of the group
gb = s[i].geometricBounds
}
};
$.writeln("Group’s bounds: " + gb + "\rObjects’s bounds: " + ob)
//your sample returns
//Group’s bounds: 50.5000000000001,20,105.306988143723,99.4833333333335
//Objects’s bounds: 64.7548342169696,120,100,172.867748674545
