Copy link to clipboard
Copied
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)
//yo
Copy link to clipboard
Copied
Using the Control Panel you can find out the outer dimensions (the W and H fields) of the selected group (first picture). Then select the second image and find its dimensions (second picture). You can then set up a proportions to determine the enlargement needed to match the dimension of the height of the original set of objects. In setting up the proportion of 54.807 (first picture) divided by 35.245 (second picture) I got the enlargement percentage of 155.5 percent and then entered that value into the fields of the scale tool. As seen in the third picture the height of the picture now matches the grouped set. The enlarged second photo is slightly wider than the group but that can either be adjusted or ignored as needed.
Copy link to clipboard
Copied
This user is looking for scripting solutions. They also are for notorious for not showing what scripting solutions they have tried. The Group object does have a geometricBounds property.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Hi rob day.
Thank you very much.
Perhaps this is all I need.
if (s[i].constructor.name != "Group")
I may have misunderstood some things.
Copy link to clipboard
Copied
I may have misunderstood some things.
You will need to get the group’s geometric bounds in order to set the rectangle’s bounds and position it relative to the group.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now