Question
Help me in Photoshop Script
I have a Script to bulk replace the SmartObject in the PSD file. It worked good in CC2015 but when I update my Photoshop Version, it doesn't work any more. I share here the part of that script which is noticed "error" by Photoshop. Anyone can help me?
// genMockup - gen mockup
///////////////////////////////////////////////////////////////////////////////
function genMockup(progressWindow, mockupFile, imagesFiles, totalFiles) {
if (!isRuning) {
return;
}
var mockupFileName = getFileName(mockupFile.fsName);
var doc = open(mockupFile);
// app.activeDocument.activeLayer=app.activeDocument.layers.itemByName("Design");
var activeDocument = app.activeDocument;
var theActiveLayer = activeDocument.activeLayer;
if (theActiveLayer.kind != "LayerKind.SMARTOBJECT") {
alert ("selected layer is not a smart object");
return;
}
for (var i = 0, len = imagesFiles.length; i < len; i++) {
var imageFileName = getFileName(imagesFiles[i].fsName);
imageFileName = imageFileName.replace('-message-card-001', '');
var theNewName = imageFileName + '-' + mockupFileName;
var outputFilePath = txtOutputPath.text + '/' + theNewName + '.jpg';
if (!isFileExisted(outputFilePath)) {
theActiveLayer = replaceDesign(outputFilePath, activeDocument, imagesFiles[i]);
if (cbxPreview.value) {
// app.refresh();
waitForRedraw();
}
}