我有一個從一個文檔到另一個複製圖層的問題。我有這樣的代碼(.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.
你有任何想法如何使它工作?