如何通过脚本复制photoshop中的文档

How to duplicate the document in photoshop via scipt

我是脚本编写的新手,我想通过脚本在 Photoshop 中复制文档,以免文档损坏。

请帮忙。

希望以下代码对您有所帮助

function duplicateDocument() {
    var idDplc = charIDToTypeID("Dplc");
    var desc25 = new ActionDescriptor();
    var idnull = charIDToTypeID("null");
    var ref1 = new ActionReference();
    var idDcmn = charIDToTypeID("Dcmn");
    var idOrdn = charIDToTypeID("Ordn");
    var idFrst = charIDToTypeID("Frst");
    ref1.putEnumerated(idDcmn, idOrdn, idFrst);
    desc25.putReference(idnull, ref1);
    executeAction(idDplc, desc25, DialogModes.NO);
}

如需更多脚本帮助,您可以关注以下内容link https://www.adobe.com/content/dam/acom/en/devnet/photoshop/pdfs/photoshop-cc-javascript-ref-2019.pdf