簡體   English   中英

自動保存在Windows上適用,但在Mac上不適用

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

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM