[英]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.