Edit script to save psd instead of png
I use this script quite often. It was enhanced yesterday by awesome people on here. I was wondering if it's possible, instead of it saving as a png to save as a psd file, but with the image size measurements still included? Many, many thanks in advance ![]()
var pth = "~/Desktop"; // path to save the file, the default save to the desktop, change as needed
var tmp = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.MM;
var w = Math.round(activeDocument.width.value);
var h = Math.round(activeDocument.height.value);
var file = new File(pth+ "/" + w+"x"+h + ".png");
save_as_png(file);
app.preferences.rulerUnits - tmp;
function save_as_png(file, filter, none, comp)
{
try {
if (filter == undefined) filter = "PNGFilterAdaptive";
if (none == undefined) none = true;
if (comp == undefined) comp = 9;
var d = new ActionDescriptor();
var d1 = new ActionDescriptor();
if (none)
d1.putEnumerated(stringIDToTypeID("PNGInterlaceType"), stringIDToTypeID("PNGInterlaceType"), stringIDToTypeID("PNGInterlaceNone"));
else
d1.putEnumerated(stringIDToTypeID("PNGInterlaceType"), stringIDToTypeID("PNGInterlaceType"), stringIDToTypeID("PNGInterlaceAdam7"));
d1.putEnumerated(stringIDToTypeID("PNGFilter"), stringIDToTypeID("PNGFilter"), stringIDToTypeID(filter));
d1.putInteger(stringIDToTypeID("compression"), comp);
d.putObject(stringIDToTypeID("as"), stringIDToTypeID("PNGFormat"), d1);
d.putPath(stringIDToTypeID("in"), file);
d.putBoolean(stringIDToTypeID("copy"), true);
executeAction(stringIDToTypeID("save"), d, DialogModes.NO);
}
catch (e) { alert(e); throw(e); }
}