[英]Auto-saving works on Windows but not on a Mac
我按照此线程中提供的代码(“ 保存而没有对话框窗口” )将图像覆盖/保存为PNG,而没有“另存为...”对话框。 它在我的Windows PC上运行良好。 但是我将脚本文件传递给了我的伴侣,他使用的是Mac,这是行不通的。 这是他向我显示的错误:
这是脚本:
// The saved directory location of the main master document.
Path = doc.path; // If the document is new there is no doc.path. Error is shown.
// Save the file.
var opts = new ExportOptionsSaveForWeb();
opts.PNG8 = false;
opts.transparency = true;
opts.interlaced = false;
opts.quality = 100;
opts.includeProfile = false;
opts.format = SaveDocumentType.PNG;
activeDocument.exportDocument(Path, ExportType.SAVEFORWEB, opts);
doc.close(SaveOptions.DONOTSAVECHANGES);
使用Photoshop,通常很难说出为什么一个骇客的东西可以在一个操作系统上运行,而不能在另一个操作系统上运行,我建议仅给.exportDocument()
提供完整的路径名:
activeDocument.exportDocument(new File(Path + "/" + doc.name.replace(/\.[^.]+$/g, ".png")), ExportType.SAVEFORWEB, opts);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.