4 Replies Latest reply on Aug 3, 2010 11:10 AM by Shonkyin

    CS5 Story::exportFile

    PeterPow Level 1

      Hello guys,


      I have a big problem with the exportFile-method of the Story scripting object. In CS4 the following code results in a file named "icml.icml"


      myStory = app.documents[0].stories.itemByID(123);
      cacheFile = new File('/Users/username/Desktop/icml.icml');

      myStory.exportFile(ExportFormat.INCOPY_MARKUP, cacheFile);


      but in CS5 the file name differs in a strange way:




      "sometext" seems to be the first n letters of the story content. Is there any way to disable this feature to have the same file name as in CS4?

      Thanks in advance!

        • 1. Re: CS5 Story::exportFile
          Laubender Adobe Community Professional & MVP

          @Peter: if that's the case, and I have no doubt, but can't test it right now, is there a rule how many additional characters will go into "-sometext"? You could then strip them from the file name by manipulating the string.



          • 2. Re: CS5 Story::exportFile
            PeterPow Level 1

            That would be a possible workaround, but my question is, why this behavior has changed in that way since CS4? In my opinion this is a bug, because its not possible any more to get the exact path to an exported file...

            • 3. Re: CS5 Story::exportFile
              Shonkyin Level 3

              Hi Peter,


              I have tried your code and its seem indesign add extra texts in exported file when same name file already exists on target place.


              Try below one becuase its working for me


              myStory = app.documents[0].stories.itemByID(197);
              cacheFile = new File('/Users/shonky/Desktop/icml.icml');
              myStory.exportFile(ExportFormat.INCOPY_MARKUP, cacheFile);
              alert("File already exists")



              • 4. Re: CS5 Story::exportFile
                PeterPow Level 1

                This is a good point, thanks. I missed the fact that the file i am exporting already exists because of a previous operation in my code. But for me this behavior is also strange, as i would expect the file to be overwritten like in CS4. But I can make a workaround so the file will not exist before exporting it.