Hello, I've done a simple script to generate some standard file formats from a base PSD. It's working nicely on some of the macs around here (all same macOS, all same CC 2019) but on some of them it stops on the first line of resizing and freezes Photoshop. Happy if someone els could test it and tell me how to solve this problem. Thanks in advance. --------------------------------------------------------------------- #target photoshop-130
var doc = app.activeDocument;
var arr = doc.name.split(".");
var extension = "";
if (arr.length>1) extension = "." + arr.pop();
var fileName = arr.join("."); // Basis-Dateiname für alle Exporte
var saveName;
function SavePSD (saveFile) {
psdSaveOpts = new PhotoshopSaveOptions();
psdSaveOpts.embedColorProfile = true;
psdSaveOpts.alphaChannels = true;
psdSaveOpts.layers = true;
activeDocument.saveAs(saveFile, psdSaveOpts, true, Extension.LOWERCASE);
};
function SaveEPS (saveFile) {
epsSaveOpts = new EPSSaveOptions();
epsSaveOpts.embedColorProfile = true;
activeDocument.saveAs(saveFile, epsSaveOpts, true, Extension.LOWERCASE);
}
function SavePNG (saveFile) {
pngSaveOpts = new PNGSaveOptions();
pngSaveOpts.interlaced = false;
pngSaveOpts.compression = 0;
activeDocument.saveAs(saveFile, pngSaveOpts, true, Extension.LOWERCASE);
}
function SaveJPG (saveFile) {
jpgSaveOpts = new JPEGSaveOptions();
jpgSaveOpts.embedColorProfile = true;
jpgSaveOpts.quality = 12;
activeDocument.saveAs(saveFile, jpgSaveOpts, true, Extension.LOWERCASE);
}
// Breite und Höhe ermitteln
var dimens = doc.artLayers[0].bounds;
var imageWidth = dimens[2];
var imageHeight = dimens [3];
// ermitteln ob Hochformat oder Querformat
var portraitSize = true;
if (imageWidth > imageHeight) {
portraitSize = false;
}
// Speichern als Backup-PSD auf Desktop
saveName = File ("~/Desktop/" + fileName + "_BACKUP.psd");
SavePSD (saveName);
// alle Ebenen auf eine Ebene reduzieren
var idMrgV = charIDToTypeID("MrgV");
executeAction(idMrgV, undefined, DialogModes.NO);
// verkleinern: längste Seite max. 25 cm bzw. 2900 pixel
if (portraitSize) {
doc.resizeImage (undefined, 2900, 300);
}
else {
doc.resizeImage (2900, undefined, 300);
}
// Speichern als EPS
saveName = File ("~/Desktop/" + fileName + ".eps");
SaveEPS (saveName);
// umwandeln in RGB
doc.changeMode(ChangeMode.RGB);
// Speichern als JPEG mit Zusatz "_L"
saveName = File ("~/Desktop/" + fileName + "_L.jpg");
SaveJPG (saveName);
// Auflösung reduzieren: 72 dpi
// max. Größe 800 x 600 pixel (B x H)
if (portraitSize) {
doc.resizeImage (undefined, 600, 72);
}
else {
doc.resizeImage (800, undefined, 72);
}
// Speichern als PNG
saveName = File ("~/Desktop/" + fileName + ".png");
SavePNG (saveName);
// verkleinern: längste Seite max. 280 pixel
if (portraitSize) {
doc.resizeImage (undefined, 280, 72);
}
else {
doc.resizeImage (280, undefined, 72);
}
// Speichern als JPEG mit Zusatz "_G"
saveName = File ("~/Desktop/" + fileName + "_G.jpg");
SaveJPG (saveName);
// verkleinern: längste Seite max. 100 pixel
if (portraitSize) {
doc.resizeImage (undefined, 100, 72);
}
else {
doc.resizeImage (100, undefined, 72);
}
// Speichern als JPEG mit Zusatz "_K"
saveName = File ("~/Desktop/" + fileName + "_K.jpg");
SaveJPG (saveName);
// Original-PSD unverändert schliessen, nicht speichern!
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
... View more