Ah, that wasn't what I had in mind...
How about this, added to the original code directly after placing the image in the frame:
selectLayerFrameContent();
interactiveTransform();
function selectLayerFrameContent() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var list = new ActionList();
var reference = new ActionReference();
reference.putName(s2t("layer"), app.activeDocument.activeLayer.name.replace(/ Frame$/, ""));
descriptor.putReference(s2t("null"), reference);
descriptor.putBoolean(s2t("makeVisible"), false);
descriptor.putList(s2t("layerID"), list);
executeAction(s2t("select"), descriptor, DialogModes.NO);
}
function interactiveTransform() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
descriptor.putEnumerated(s2t("freeTransformCenterState"), s2t("quadCenterState"), s2t("QCSAverage"));
descriptor2.putUnitDouble(s2t("horizontal"), s2t("pixelsUnit"), 0);
descriptor2.putUnitDouble(s2t("vertical"), s2t("pixelsUnit"), 0);
descriptor.putObject(s2t("offset"), s2t("offset"), descriptor2);
descriptor.putUnitDouble(s2t("width"), s2t("percentUnit"), 100);
descriptor.putUnitDouble(s2t("height"), s2t("percentUnit"), 100);
executeAction(s2t("transform"), descriptor, DialogModes.ALL);
}
Remove the first function if redundant.
... View more