Есть два способа. (в VB перевдешь...)
. Рекурсивный поиск границ всех объектов документа (включая маски)
// Select All
for(i=0; i
// Searching Bounds
mySelection = activeDocument.selection;
if ((mySelection instanceof Array) && (mySelection.length > 0)) {
bounds = getBounds(mySelection[0]);
for(i=1; i
abounds = getBounds(mySelection[i]);
if( bounds[0] > abounds[0] ) bounds[0] = abounds[0];
if( bounds[1] < abounds[1] ) bounds[1] = abounds[1];
if( bounds[2] < abounds[2] ) bounds[2] = abounds[2];
if( bounds[3] > abounds[3] ) bounds[3] = abounds[3];
}
}
// Deselect all
activeDocument.selection = null;
// Showing Info
alert(\"Bounds: \"
+ bounds[0] + \", \"
+ bounds[1] + \", \"
+ bounds[2] + \", \"
+ bounds[3] );
function getBounds(obj) {
var vbounds = new Array();
if( obj.typename == 'TextFrame' ) {
objcopy=obj.duplicate().createOutline();
vbounds = objcopy.visibleBounds;
objcopy.remove();
}
else if( (obj.typename == 'GroupItem') && !obj.clipped ) {
vbounds = getBounds(obj.pageItems[0]);
for( n=1; n
vgb = getBounds(obj.pageItems[n]);
if( vbounds[0] > vgb[0] ) vbounds[0] = vgb[0];
if( vbounds[1] < vgb[1] ) vbounds[1] = vgb[1];
if( vbounds[2] < vgb[2] ) vbounds[2] = vgb[2];
if( vbounds[3] > vgb[3] ) vbounds[3] = vgb[3];
}
}
else if( (obj.typename == 'GroupItem') && obj.clipped && (obj.pageItems.length > 1) ) {
vbounds = getBounds(obj.pageItems[0]);
cvgb = getBounds(obj.pageItems[1]);
objleft = cvgb[0];
objtop = cvgb[1];
objright = cvgb[2];
objbottom = cvgb[3];
obj.pageItems[0].stroked ? so = 0 : so = 1;
for( n=so; n
cvgb = getBounds(obj.pageItems[n]);
if( objleft > cvgb[0] ) objleft = cvgb[0];
if( objtop < cvgb[1] ) objtop = cvgb[1];
if( objright < (cvgb[2]) ) objright = cvgb[2];
if( objbottom > (cvgb[3]) ) objbottom = cvgb[3];
}
if( vbounds[0] < objleft ) vbounds[0] = objleft;
if( vbounds[1] > objtop ) vbounds[1] = objtop;
if( vbounds[2] > objright ) vbounds[2] = objright;
if( vbounds[3] < objbottom ) vbounds[3] = objbottom;
}
else {
vbounds = obj.visibleBounds;
}
return vbounds;
}
И немного могут отличаться значения. (Я особо не тестировал)
. Выколупать этот HiResBoundingBox прямо из хедера дока (тоже через скрипт) :evil: