1 Reply Latest reply: Nov 2, 2012 1:02 AM by MarkusVeith RSS

    Photoshop Saving... Code review needed getting "destination folder does not exist"

    riafan

      I'm running Photoshop (CS5).  When I run the ExportFlexSkins.jsx I get an error "destination folder does not exist"

       

      The notes on that script show that it was written back when CS3 was out.

       

      I'm assuming the file saving options (spec. Save for Web) has changed since CS3.

       

      I'm really stuck as this is broken in CS5, I'd love some input...


      Here's the offending function

       

       

      function s4wPNG(directorypath){

      var id41 = charIDToTypeID( "Expr" );

          var desc9 = new ActionDescriptor();

          var id42 = charIDToTypeID( "Usng" );

              var desc10 = new ActionDescriptor();

              var id43 = charIDToTypeID( "Op  " );

              var id44 = charIDToTypeID( "SWOp" );

              var id45 = charIDToTypeID( "OpSa" );

              desc10.putEnumerated( id43, id44, id45 );

              var id46 = charIDToTypeID( "Fmt " );

              var id47 = charIDToTypeID( "IRFm" );

              var id48 = charIDToTypeID( "PN24" );

              desc10.putEnumerated( id46, id47, id48 );

              var id49 = charIDToTypeID( "Intr" );

              desc10.putBoolean( id49, false );

              var id50 = charIDToTypeID( "Trns" );

              desc10.putBoolean( id50, true );

              var id51 = charIDToTypeID( "Mtt " );

              desc10.putBoolean( id51, true );

              var id52 = charIDToTypeID( "MttR" );

              desc10.putInteger( id52, 255 );

              var id53 = charIDToTypeID( "MttG" );

              desc10.putInteger( id53, 255 );

              var id54 = charIDToTypeID( "MttB" );

              desc10.putInteger( id54, 255 );

              var id55 = charIDToTypeID( "SHTM" );

              desc10.putBoolean( id55, false );

              var id56 = charIDToTypeID( "SImg" );

              desc10.putBoolean( id56, true );

              var id57 = charIDToTypeID( "SSSO" );

              desc10.putBoolean( id57, false );

              var id58 = charIDToTypeID( "SSLt" );

                  var list3 = new ActionList();

              desc10.putList( id58, list3 );

              var id59 = charIDToTypeID( "DIDr" );

              desc10.putBoolean( id59, false );

              var id60 = charIDToTypeID( "In  " );

       

       

       

       

              desc10.putPath( id60, new File(directorypath));

          var id61 = stringIDToTypeID( "SaveForWeb" );

          desc9.putObject( id42, id61, desc10 );

             //alert (directorypath, 'create file',null);

       

      executeAction( id41, desc9, DialogModes.NO );

      }

        • 1. Re: Photoshop Saving... Code review needed getting "destination folder does not exist"
          MarkusVeith Community Member

          Hi,

           

          i just had the same issue and found a solution that works for me in photoshop cs 5.1 (i think this will also work in cs 5). Although this thread is very old maybe somebody is interested in my solution:

           

          I replaced the code in the function s4wPNG like this:

          function s4wPNG(directorypath){

              var pngSaveOptions = new PNGSaveOptions();

              var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');

              var Ext = decodeURI(app.activeDocument.name).replace(/^.*\./,'');

              var saveFile = File(directorypath + Name +".png");

              activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);

          }

           

          Hope this is helpful.

           

          Cheers,

           

               Markus Veith