[FIXED] Das automatische Sparung funktioniert unter Windows, aber nicht auf einem Mac

Ausgabe

Ich habe den in diesem Thread bereitgestellten Code ( Speichern ohne Dialogfenster ) befolgt, um das Bild als PNG ohne den Dialog “Speichern unter…” zu überschreiben/speichern. Auf meinem Windows-PC funktioniert es einwandfrei. Aber ich habe die Skriptdatei an meinen Partner weitergegeben, er benutzt einen Mac, es funktioniert nicht. Dies ist der Fehler, den er mir gezeigt hat:

Error

Hier ist das Skript:

    // 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);

Lösung

Bei Photoshop ist es normalerweise schwierig zu sagen, warum ein hackiges Ding auf einem Betriebssystem funktioniert, aber nicht auf dem anderen. Ich würde vorschlagen, nur einen vollständigen Pfadnamen zu geben .exportDocument():

activeDocument.exportDocument(new File(Path + "/" + doc.name.replace(/\.[^.]+$/g, ".png")), ExportType.SAVEFORWEB, opts);


Beantwortet von –
Sergey Kritskiy


Antwort geprüft von –
Timothy Miller (FixError Admin)

0 Shares:
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like