Yes - possible - does this work for you?
// Step 1: Scale selected grouped objects to 81%
var doc = app.activeDocument;
var selection = doc.selection;
if(selection.length > 0) {
for(var i = 0; i < selection.length; i++) {
var item = selection[i];
if(item.constructor.name === "Group") {
var scaleFactor = 81 / 100; // Scale factor for 81%
var itemBounds = item.geometricBounds;
var centerX = (itemBounds[1] + itemBounds[3]) / 2;
var centerY = (itemBounds[0] + itemBounds[2]) / 2;
var transformMatrix = app.transformationMatrices.add({horizontalScaleFactor: scaleFactor, verticalScaleFactor: scaleFactor});
item.transform(CoordinateSpaces.INNER_COORDINATES, AnchorPoint.CENTER_ANCHOR, transformMatrix);
}
}
}
// Step 2: Change the document Document Setup from 297mm x 210mm to 148mm to 210mm
doc.documentPreferences.pageWidth = "148mm";
doc.documentPreferences.pageHeight = "210mm";
// Step 3: Centre to page vertically & horizontally
var page = doc.pages[0]; // Assuming you want to center on the first page
var pageBounds = page.bounds;
var pageWidth = pageBounds[3] - pageBounds[1];
var pageHeight = pageBounds[2] - pageBounds[0];
for(var i = 0; i < selection.length; i++) {
var item = selection[i];
var itemBounds = item.geometricBounds;
var itemWidth = itemBounds[3] - itemBounds[1];
var itemHeight = itemBounds[2] - itemBounds[0];
item.move([
(pageWidth - itemWidth) / 2,
(pageHeight - itemHeight) / 2
]);
}
alert("Script completed successfully!");