var myPic = app.activeDocument.allGraphics;
var PicCount = myPic.length;
for (i=0; i<PicCount;i++){
myPic[i].parent.fit(1718906723);
}//for
alert("Готово");
var myPage = app.activeDocument.pages;
for (i=0;i<myPage.length;i++){
var myPicC = myPage[i].allGraphics[0].geometricBounds;
var myTFC = myPage[i].textFrames[0].geometricBounds;
myPage[i].textFrames[0].geometricBounds = [myTFC[0],myTFC[1],myTFC[2],myPicC[3]];
if (myPage[i].textFrames[0].texts[0].lines.length>2) {myPage[i].textFrames[0].fit(1718906723);}
}