5 Replies Latest reply on Oct 23, 2012 11:50 AM by J-Williams2

    asynchronousExportFile problem with mounted windows volumes

    J-Williams2

           Hi

      I am seeing a very strange issue with the Indesign asynchronousExportFile and doc.exportFile functions. They work perfectly in most cases but if the user is on a Mac and has a Windows mounted volume, the Indesign level asynchronousExportFile function appears to try to add "/Volumes" to the path to store the file even though it has not been directed to use this path.

       

      Here is the code snippet in which i am referring to.


      var outFile:File = File.documentsDirectory;

      outFile = outFile.resolvePath("MyTmpFilePath");

      outFile.createDirectory();

       

      if(outFile.exists){

           outFile = outFile.resolvePath(outFile.nativePath+File.separator+fileName);

           var task:BackgroundTask = doc.asynchronousExportFile(ExportFormat.PDF_TYPE,outFile,false);

           task.waitForTask();

      }

       

      This is the error I get

      CSAWLib.CSLogger CSHostObject.hostCall() failed on asynchronousExportFile - 1952403524,

      /Users/jess/Documents/MyTmpFilePath/1-1.pdf with msg: Cannot find the folder “/Volumes/Users/jess/Documents/MyTmpFilePath/1-1.pdf”.

       

      As you can see /Users/jess/Documents/MyTmpFilePath/1-1.pdf is the correct path i fed the function, but somewhere in the adobe code adds "/Volumes" since i have "/Volumes/Users" as a mounted directory. It should not be converting the path to “/Volumes/Users/jess/Documents/MyTmpFilePath/1-1.pdf”. This is a non existing path since the Windows mount does not have the user "jess".

       

      If I unmount the Windows volume everthing works again. As a test I even unmounted all volumes and went into my Volumes directory and created a directory named "/Volumes/Users/abc", this causes the problem to appear imediately again. We have tried this on multiple machines and the behavoir is the same. I have also tried tricking the the function into using a different directory by use of "../../" etc to no avail.

       

      I have also noticed that the moment I take out the "/Users" portion of the path, everything works fine. Unfortunately this is not an option as many users do not have priveledges to write files outside of their user's sandbox.

       

      Please, I have struggled with this issue for days on end now and searched all of the forums. Any light that someone could shed on this subject would be very helpful.

      Thanks

        • 1. Re: asynchronousExportFile problem with mounted windows volumes
          Harbs. Level 6

          Take a look at this:

          http://forums.adobe.com/message/4187884#4187884

           

          You can probably adapt that solution to ActionScript...

          • 2. Re: asynchronousExportFile problem with mounted windows volumes
            J-Williams2 Level 1

            Thanks for the lead unfortunately this did not work.

            I believe it is because the problem is inside of asynchronousExportFile call.

            If I trace the file.nativePath before i send it into the "asynchronousExportFile" function the reported path is correct.

             

            Based on the supplied info in this discussion:
            http://forums.adobe.com/message/4187884#4187884

             

            The idea is that it is returning the incorrect path in the first place which it is not in my case.

            I did try though. Here is what i ended up with.

             

            outFile = outFile.resolvePath(outFile.nativePath+File.separator+fileName);

            var finalFile:File = new File(outFile.nativePath.replace(/^\/Volumes/,"/"));  //replacing all occurences of /Volumes

             

            var task:BackgroundTask = doc.asynchronousExportFile(ExportFormat.PDF_TYPE,finalFile,false);

            task.waitForTask();

             

             

            Here is my result:

            Before the error:

            LOG: FILEPATH RIGHT BEFORE EXPORT === /Users/jess/Documents/EditorialManagerLt/1-1.pdf

            The Error:

            CSAWLib.CSLogger CSHostObject.hostCall() failed on asynchronousExportFile - 1952403524,/Users/jess/Documents/EditorialManagerLt/1-1.pdf

            with msg: Cannot find the folder “/Volumes/Users/jess/Documents/EditorialManagerLt/1-1.pdf”.

            Cannot find the folder “/Volumes/Users/jess/Documents/EditorialManagerLt/1-1.pdf”.

            Error: Cannot find the folder “/Volumes/Users/jess/Documents/EditorialManagerLt/1-1.pdf”.

             

            I am surprised no one else has run into this problem with creative suite considering many magazine publishers using indesign and Adobe products use Macs and mount windows machines.

             

            Any other work around suggestions would be greatly appreciated as we cannot go to market with the product until this is resolved.

            • 3. Re: asynchronousExportFile problem with mounted windows volumes
              Harbs. Level 6

              Make the call in ExtendScript instead of ActionScript.

              • 4. Re: asynchronousExportFile problem with mounted windows volumes
                Harbs. Level 6

                J-Williams2 wrote:

                 

                I believe it is because the problem is inside of asynchronousExportFile call.

                The problem is probably in the ActionScript wrapper around the ExtendScript call. If you make the ExtendScript call yourself directly, it should work.

                • 5. Re: asynchronousExportFile problem with mounted windows volumes
                  J-Williams2 Level 1

                  Hi Harbs

                  Thank you!

                  This worked.

                   

                  Here is what ended up doing:

                  I used this cookbook article to create a jsx file

                  http://cookbooks.adobe.com/post_Communicating_between_JavaScript_and_the_Creative-17383.ht ml

                   

                  Then I was able to do the work with no problem with a couple of extendscript functions

                   

                  function exportPDF(fp){

                              var doc = app.activeDocument;

                                  doc.asynchronousExportFile(ExportFormat.PDF_TYPE,normalizeFilePath(File(fp)),false);

                              return true;

                  }

                   

                  function exportJPG(fp){

                              var doc = app.activeDocument;

                              doc.exportFile(ExportFormat.JPG,normalizeFilePath(File(fp)),false)

                              return true;

                  }

                   

                  function normalizeFilePath(file){

                            if(File.fs != "Macintosh"){return file}

                            return File(file.fsName.replace(/^\/Volumes/,"/" + File("///").parent.displayName));

                  }

                   

                  Thanks again for your help in acheiving a work around!