How can I correctly move unexpanded Compound Shapes in Illustrator using a script?
When I try to move and scale selected objects in Illustrator using a script, the unexpanded Compound Shapes cannot be moved correctly, while other objects or groups (including unexpanded Compound Shapes) can be moved correctly. Can anyone guide me on how to modify the JSX script to properly move these objects?
var doc = app.activeDocument;
var selection = doc.selection;
var moveX = 10;
var moveY = 20;
var scaleX = 0.9;
var scaleY = 0.8;
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.parent instanceof GroupItem) {
continue;
}
item.resize(
scaleX * 100, // x
scaleY * 100, // y
true, // changePositions
true, // changeFillPatterns_value
true, // changeFillGradients
true, // changeStrokePattern
1 ? Math.sqrt(scaleX * scaleY) * 100 : 100,
Transformation.TOPLEFT
);
item.left += moveX;
item.top -= moveY;
}

