-
1. Re: JS CS3 copy, paste and transform
John.Kordas Sep 8, 2009 7:29 PM (in response to John.Kordas)I've attached an indesign doc as an example. If I select the group and use the following line:
app.selection[0].geometricBounds = [0,0,38,38];
The group frame is resized but the content is not and all the text frames overflow. Is there a way to resize the frame and also affect the content, the same way you would manually hold Ctrl and resize the frame?
John.
-
2. Re: JS CS3 copy, paste and transform
John.Kordas Sep 9, 2009 7:21 PM (in response to John.Kordas)This seems to be working. I went with the transform() in the end. If anyone has a better way please let me know.
var myNewGroup = new Array;
//make group
for (i=app.selection.length-1; i>=0; i--) {
myNewGroup.push (app.selection[i]);
}
var myGroup = app.activeDocument.groups.add(myNewGroup);
myGroup.move(Array(0,0) )
//get size of group
var mySelSize = myGroup.geometricBounds;
//get size of document
var myDocHSize = app.activeDocument.documentPreferences.pageHeight;
var myDocWSize = app.activeDocument.documentPreferences.pageWidth;
//get scale value
var myScalH = myDocHSize/mySelSize[2];
var myScalW = myDocWSize/mySelSize[3];
//apply transform scale
var myScaleMatrix = app.transformationMatrices.add({horizontalScaleFactor:myScalW, verticalScaleFactor:myScalH});myGroup.transform(CoordinateSpaces.pasteboardCoordinates,AnchorPoint.topLeftAnchor, myScaleMatrix);

