Hi vinny38, Welcome back! Thank you, once again for showing interest in the question. I tried your version 7 of the script in the original document and found: 1. The script rescaled even the in-bound images, again (which were needed to be left alone) 2. When I ran the script, it gave me the following error and left the very large image frame in their original size and did not change back the custom positioning to inline: 3. I tried it one more time, then the script worked. Upon the next trial, it gave the same error. However, when I ran the same script in the sample document that I had shared, it worked wonders. Everything, you has written in the script worked but the script rescaled the in-bound images, as well. So, I am not able to figure out the anomaly in the original document though the sample document had been derived from the original, itself. Additionally, I tried to tweak with your version 4 in terms of scaling factor and the script worked like charm. Though it rescaled the size of all the images, but did not give any error and worked perfectly: //FitAnchorToColumn v4 //by Vinny if (parseFloat(app.version) < 6) main(); else app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "FitAnchorToColumn"); function main() { if (app.documents.length > 0) { var myDoc = app.activeDocument, docUnits = myDoc.viewPreferences.horizontalMeasurementUnits, myFound; app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = "~a"; myFound = myDoc.findGrep(); // first rescale overflow objects to 45% for (i = 0; i < myFound.length; i++) { if (typeof myFound.parentTextFrames[0] == "undefined") { // alert(myFound.pageItems[0].geometricBounds); myFound.pageItems[0].transform( CoordinateSpaces.INNER_COORDINATES, AnchorPoint.TOP_LEFT_ANCHOR, app.transformationMatrices.add({ horizontalScaleFactor: .45, verticalScaleFactor: .45 }) ) } } // then fit everything to column width if possible, otherwise to column height app.findGrepPreferences = app.changeGrepPreferences = null; app.findGrepPreferences.findWhat = "~a"; myFound = myDoc.findGrep(); for (i = 0; i < myFound.length; i++) { if (typeof myFound.parentTextFrames[0] != "undefined") { var columnWidth = myFound.parentTextFrames[0].textFramePreferences.textColumnFixedWidth, columnHeight = myFound.parentTextFrames[0].geometricBounds[2] - myFound.parentTextFrames[0].geometricBounds[0], myObjectWidth = myFound.pageItems[0].geometricBounds[3] - myFound.pageItems[0].geometricBounds[1], myObjectHeight = myFound.pageItems[0].geometricBounds[2] - myFound.pageItems[0].geometricBounds[0], myScaleFactorH = (columnWidth / myObjectWidth) - 0.15, myScaleFactorV = (columnHeight / myObjectHeight) - 0.15, myScaleMatrixH = app.transformationMatrices.add({ horizontalScaleFactor: myScaleFactorH, verticalScaleFactor: myScaleFactorH }), myScaleMatrixV = app.transformationMatrices.add({ horizontalScaleFactor: myScaleFactorV, verticalScaleFactor: myScaleFactorV }); if (myObjectHeight * myScaleFactorH == columnHeight) { return null; } else if (myObjectHeight * myScaleFactorH < columnHeight) { myFound.pageItems[0].transform( CoordinateSpaces.INNER_COORDINATES, AnchorPoint.TOP_LEFT_ANCHOR, myScaleMatrixH); } else { myFound.pageItems[0].transform( CoordinateSpaces.INNER_COORDINATES, AnchorPoint.TOP_LEFT_ANCHOR, myScaleMatrixV); } } } app.findGrepPreferences = app.changeGrepPreferences = null; } else { alert("Open a document"); } } This one worked, perfectly when I changed the rescale overflow from 5% to 45% and changed the scale factor by 0.15. However, the rescale overflow seems to be a specific measure as for humongous image frames, this might not be an ideal solution for which, your version 7 of the script could work. However, the anomaly of the script to work one time and not the other time, seems to be interesting. Regards, Aman
... View more