@dublove
Try this script:
/*
Zoom to 46% of Fit On Screen Zoom
Stephen Marsh
https://community.adobe.com/questions-712/can-this-script-be-modified-to-fit-46-of-the-screen-1560318
*/
#target photoshop
// Fit on Screen
var fitDesc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Mn "), charIDToTypeID("MnIt"), charIDToTypeID("FtOn"));
fitDesc.putReference(charIDToTypeID("null"), ref);
executeAction(charIDToTypeID("slct"), fitDesc, DialogModes.NO);
// Read the the current zoom
var docRef = new ActionReference();
docRef.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var docDesc = executeActionGet(docRef);
var fitZoom = docDesc.getDouble(stringIDToTypeID("zoom")) * 100;
// Calculate the target zoom
var FACTOR = 0.46;
var targetZoom = fitZoom * FACTOR;
// Apply the calculated zoom
setZoomLevel(targetZoom);
// Optional confirmation
alert("Fit zoom: " + Math.round(fitZoom * 10) / 10 + "%\n" + "Target (" + (FACTOR * 100) + "% factor): " + Math.round(targetZoom * 10) / 10 + "%");
///// FUNCTIONS /////
function setZoomLevel(zoomPercent) {
if (zoomPercent < 1) zoomPercent = 1;
var originalRes = activeDocument.resolution;
// Get the screen resolution
var screenRef = new ActionReference();
screenRef.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var screenRes = executeActionGet(screenRef)
.getObjectValue(stringIDToTypeID("unitsPrefs"))
.getUnitDoubleValue(stringIDToTypeID("newDocPresetScreenResolution")) / 72;
// Change the resolution temporarily
activeDocument.resizeImage(undefined, undefined, screenRes / (zoomPercent / 100), ResampleMethod.NONE);
// Zoom to print size
var printDesc = new ActionDescriptor();
var printRef = new ActionReference();
printRef.putEnumerated(charIDToTypeID("Mn "), charIDToTypeID("MnIt"), charIDToTypeID("PrnS"));
printDesc.putReference(charIDToTypeID("null"), printRef);
executeAction(charIDToTypeID("slct"), printDesc, DialogModes.NO);
// Restore the original resolution
activeDocument.resizeImage(undefined, undefined, originalRes, ResampleMethod.NONE);
}