exportDocument() 'destination folder does not exist' error

Posted by dvb on Stack Overflow See other posts from Stack Overflow or by dvb
Published on 2011-01-03T17:41:56Z Indexed on 2011/01/03 17:53 UTC
Read the original article Hit count: 241

Filed under:

I'm trying to make a script in photoshop that will modify some layers and than export them as a PNG image. I've copied the following code from another place:

function SavePNG(saveFile){
    var pngOpts = new ExportOptionsSaveForWeb; 
    pngOpts.format = SaveDocumentType.PNG
    pngOpts.PNG8 = false; 
    pngOpts.transparency = true; 
    pngOpts.interlaced = true; 
    pngOpts.quality = 100;
    activeDocument.exportDocument(saveFile,ExportType.SAVEFORWEB,pngOpts);
}

The function export the active document of photoshop to the file specified by the saveFile parameter.

It's working fine with simple paths like 'C:\images\result.png' but when trying with different paths like '~/Desktop/' or paths with some special characters the file isn't exported, and a 'destination folder does not exist' error massage appear.

Any idea how can I solve it?

© Stack Overflow or respective owner

Related posts about photoshop-script