2 Replies Latest reply on Jul 25, 2015 8:02 PM by Chris Panny

    How does JavaScript handle spaces in a directory path for saveAs statement?

    Chris Panny Level 1



      Below is a function I wrote that is supposed to save a file out as a jpeg to a specific subfolder on my machine. The directory path has several spaces and it's causing the function to fail. (There is a space in DCS Partnership and TAC Project below on line 2 of the function).


      Does anyone know how to write a path in the new File object that has spaces in the path? (Maybe there's a special character to denote a single space??)


      function saveScene (fileName){

          jpgFile = new File( "C/Temp/DCS Partnership/TAC Project/Scenes_Listellos" +  fileName);

          jpgSaveOptions = new JPEGSaveOptions();

          jpgSaveOptions.embedColorProfile = true;

          jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;

          jpgSaveOptions.matte = MatteType.NONE,

          jpgSaveOptions.quality = 12;

        docActive.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);

            } // end function saveScene