Extendscript: Couldn't complete the Action, since the destination folder doesn't exist


"adobe photoshop (cs 6 on mac):using extendscript (below) convert file size .psd .png"

 

 

save web error: couldn't complete action, since destination folder not exists". can help?

 

 

i trying convert image size 1 input folder output folder:

 

#target "photoshop"

 

var outputwidth = 1024;

var inputfolder = folder.selectdialog("input folder");

var outputfolder = folder.selectdialog("output folder");

 

 

 

 

if (inputfolder != null && outputfolder != null) {

    var files = inputfolder.getfiles("*.psd");

 

    (var = 0; < files.length; i++) {

 

        var file = files[i];

        var doc = app.open(file);

 

        if (doc.width > outputwidth) {

            var height = (doc.height / doc.width) * outputwidth;

            doc.resizeimage(outputwidth + "px", height + "px");

        }

 

        var options = new exportoptionssaveforweb();

        options.format = savedocumenttype.png;

        options.png8 = false;

 

 

        doc.exportdocument(outputfolder, exporttype.saveforweb, options);

    doc.close(saveoptions.donotsavechanges);

        $.writeln('file ' + (i + 1) + ' of ' + files.length + ' processed');

    }

}

i have added few comments, hope helps...

 

 

#target "photoshop" var outputwidth = 1024; var inputfolder = folder.selectdialog("input folder"); var outputfolder = folder.selectdialog("output folder"); var startrulerunits = preferences.rulerunits; //make sure working pixels preferences.rulerunits = units.pixels; if (inputfolder != null && outputfolder != null) {     var files = inputfolder.getfiles("*.psd");     (var = 0; < files.length; i++) {         var file = files[i];         var doc = app.open(file);         if (doc.width > outputwidth) {             var height = (doc.height / doc.width) * outputwidth;            /*  doc.resizeimage(outputwidth + "px", height + "px"); */            //only 1 value required             doc.resizeimage(outputwidth, undefined, undefined, resamplemethod.bicubicsharper);         }         var options = new exportoptionssaveforweb();         options.format = savedocumenttype.png;         options.png8 = false;         //get filename without extension         var name = app.activedocument.name.replace(/\.[^\.]+$/, '');         //build output file name , path         var savefile = file(outputfolder + "/" + name + ".png");         //you need have full filepath not folder         doc.exportdocument(/*outputfolder */savefile, exporttype.saveforweb, options);     doc.close(saveoptions.donotsavechanges);         $.writeln('file ' + (i + 1) + ' of ' + files.length + ' processed');     } //restore ruler units app.preferences.rulerunits = startrulerunits; }  


More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support