Photoshop 脚本突然停止工作 - 错误 8000

Photoshop script suddenly stopped working - Error 8000

所以我根据this generator

为Photoshop做了一个脚本

重要的部分是

#target photoshop

function main() {
    //  prompt user to select source file, cancel returns null
    var sourceFile = File.openDialog("Select a 1:1 sqaure PNG file that is at least 618x618.", "*.png", false);
    if (sourceFile == null)  { 
        // user canceled
        return;
    }

    var doc = open(sourceFile, OpenDocumentType.PNG);
    if (doc == null) {
        alert("Oh shit!\nSomething is wrong with the file. Make sure it is a valid PNG file.");
        return;
    }

....
}

main();

这一直有效。但是今天我想在脚本中更改一些东西(我还没有开始,大约 2 周没有使用它)我突然只得到一个错误(翻译自德语):

Error 8000: The file can not be opened since the parameters for opening are incorrect.
Line:764
-> doc = open(sourceFile, OpenDocumentType.PNG);

如何通过 Photoshop 脚本中的 File.Open 对话框打开 PNG 文件?


我已经尝试添加 app

var doc = app.open(sourceFile, OpenDocumentType.PNG);

删除文档类型说明符

var doc = open(sourceFile);

或者添加我在很多论坛上看到的这个

var doc = open(sourceFile, OpenDocumentType.PNG, undefined);

以及它们之间的差异。到目前为止没有任何帮助。


为了调试我还添加了

alert(sourceFile);

在相应的行之前得到例如

~/Desktop/Example/originalImage_2000x2000.png

问题显然出在 Photshop 上! 当我打开 Photshop 时,我什至没有获得上次打开文件等的默认视图,实际上无法打开 any 文件...但从未首先测试过。

重启 PC 并启动 Photoshop 后一切恢复正常,脚本运行正常,符合预期。