Photoshop Javascript scripting saving and closing document

后端 未结 1 641
轮回少年
轮回少年 2021-01-07 02:34

I\'m having trouble saving for some reason; I\'m using Photoshop CS5.1 (if that really is the cause of the issue)

error 8800: General Photoshop error occurr         


        
1条回答
  •  清酒与你
    2021-01-07 02:57

    When you get the error General Photoshop error while saving it usually means a problem with the save path. Photoshop is trying to save to a location that doesn't exist. This works assuming the folder C:/Users/Barney/Pictures/Temp001 exists:

    var thistimestamp = Math.round(new Date().getTime() / 1000);
    saveFile = new File( "c:/Users/Barney/Pictures/Temp001/" +thistimestamp)
    saveOptions = new JPEGSaveOptions();
    saveOptions.embedColorProfile = true;
    saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
    saveOptions.matte = MatteType.NONE;
    saveOptions.quality = 9;
    
    app.activeDocument.saveAs(saveFile, saveOptions, true,Extension.LOWERCASE);
    

    The only changes I made were to to the path string saveFile = new File("C:/Users/Barney/Pictures/Temp001/" + thistimestamp) Notice I added the C: to make it an absolute path and added a / after Temp001 to specify this is a folder and not part of the final file name. My Pictures should actually be Pictures (my pictures is just an alias), which is what you get if you copy the address from the address bar. Also I removed the + ".jpeg" because photoshop takes care of the file extension for you.

    If you're trying to create a new folder you have to use the Folder object:

    var myfolder = new Folder("c:/Users/Barney/Pictures/Temp001/");
    myfolder.create();
    

    0 讨论(0)
提交回复
热议问题