3 Replies Latest reply on Oct 30, 2011 11:44 AM by xbytor2

    SaveForWeb bug

    xbytor2 Level 4

      I've found what looks like an interesting bug.

       

      If you have certain non-ASCII characters (like è) in a folder name that you are doing

      a SaveForWeb export to, the export fails with a 'destination does not exist' error.

       

      Try this bit of code with an image open.

       

      function main() {
        var doc = app.activeDocument;
        var fname = "~/Desktop/Folder-èæŸ";
        var folder = Folder(fname);
        folder.create();
      
        var opts = new ExportOptionsSaveForWeb();
      
        opts.format = SaveDocumentType.JPEG;
      
        var file = new File(folder + "/test-èæ.jpg");
      
        doc.exportDocument(file, ExportType.SAVEFORWEB, opts);
      };
      
      main(); 
      

       

      The odd bit is that works via the UI bu if you record it in an action, the action fails just like the script.

       

      Anyone else see this problem before or know of a work-around?

        • 1. Re: SaveForWeb bug
          xbytor2 Level 4

          Just a bit more info:

           

          This is a problem on Win7 but not on OS X.

          • 2. Re: SaveForWeb bug
            Paul Riggott Level 6

            I haven't seen this before but even when it can save to a folder without those characters, the filename is corrupted if (it contains those chars)

            Normal saveas is fine.

             

            I think this is one for Adobe to fix.

            • 3. Re: SaveForWeb bug
              xbytor2 Level 4

              even when it can save to a folder without those characters, the filename is corrupted if (it contains those chars)

              Normal saveas is fine.

               

              But I have a work-around for this. Do the Export using SL code like this:

                 // a bunch of code to setup sfwDesc omitted....
              
                  var odesc = executeAction(cTID("Expr"), sfwDesc, DialogModes.NO); // do SaveForWeb
              
                  // In some situations, SfW munges the file name if there
                  // is a potential character set issue.
                  if (!outfile.exists) {  // our target file was not created
                    
                    if (odesc.count != 0) {      // 0 if 'destination folder does not exist'
                      var desc = odesc.getObjectValue(cTID("Usng"));
              
                      var f = desc.getPath(cTID("In  "));  // if the filename was changed, here is the new name
                      f.rename(outfile.name);
              
                    } else {
                      Error.runtimeError(9001, "Unknown error with Save for Web");
                    }
                  }
              

               

              I think this is one for Adobe to fix.

               

              I suspect so.