I want use Photoshop CS6 for batch editing because it is lite and can be used in sandboxie software.
following script is fully execute in the latest version of Photoshop (2023):
#target photoshop
/* Check for selection - from jazz-y */
var selectionBounds = null;
try {
selectionBounds = activeDocument.selection.bounds
} catch (e) {}
if (selectionBounds) {
/* Start Process selected layers - from jazz-y */
var s2t = stringIDToTypeID;
(r = new ActionReference()).putProperty(s2t('property'), p = s2t('targetLayersIDs'));
r.putEnumerated(s2t('document'), s2t('ordinal'), s2t('targetEnum'));
var lrs = executeActionGet(r).getList(p),
sel = new ActionReference();
for (var i = 0; i < lrs.count; i++) {
sel.putIdentifier(s2t('layer'), p = lrs.getReference(i).getIdentifier(s2t('layerID')));
(r = new ActionReference()).putIdentifier(s2t('layer'), p);
(d = new ActionDescriptor()).putReference(s2t("target"), r);
executeAction(s2t('select'), d, DialogModes.NO);
/* End Process selected layers - from jazz-y */
/* Clear selected layers */
try {
activeDocument.selection.clear()
} catch (e) {}
}
} else {
alert("This script requires a selection!");
}
but when i run above script in CS6 i get following error:
how to fix this error in CS6?