我有一个从一个文档到另一个复制图层的问题。我有这样的代码(.jsx脚本我的Photoshop文档内)JSX复制图层adobe photoshop
var docRef = app.activeDocument;
app.activeDocument.selection.selectAll();
var calcWidth = app.activeDocument.selection.bounds[2] -app.activeDocument.selection.bounds[0];
var calcHeight = app.activeDocument.selection.bounds[3] - app.activeDocument.selection.bounds[1];
var docResolution = app.activeDocument.resolution;
var document = app.documents.add(calcWidth, calcHeight, docResolution);
app.activeDocument = docRef;
try {
dupObj.artLayers[i].duplicate(document, ElementPlacement.INSIDE);
}
catch(e) {
alert(e)
}
但我仍然收到错误
Error: You can only duplicate layers from the frontmost document.
你有任何想法如何使它工作?