2 Replies Latest reply on Aug 23, 2008 11:35 AM by (Olav_Kvern)

    Export text in pc format

      Hellow

      I' tried export text into textFrame in p.c. format but I can't.
      I created this script but it isn't work. What can I made wrong ?

      var myStories = myDocument.textFrames[myCounter].parentStory;
      myStories.textExportPreference.platform = ImportPlatform.pc;
      myFile = new File(caminhoCollect + "/" + myStories.label + ".txt");
      myStories.exportFile(ExportFormat.textType, myFile);

      thanks

      Carlos Cubas
        • 1. Re: Export text in pc format
          Loic.Aigon Adobe Community Professional
          Hi, just don't bother.
          http://indesignsecrets.com/exporting-all-stories-text-rtf.php
          Loic
          • 2. Re: Export text in pc format
            Level 1
            Hi Carlos,

            Let's look through your script one line at a time.

            var myStories = myDocument.textFrames[myCounter].parentStory;
            

            The trouble with this line is that if your document contains any linked text frames, you'll end up exporting the story multiple times. Instead, you should iterate through stories, as shown in the ExportAllStories example script.

            myStories.textExportPreference.platform = ImportPlatform.pc;
            

            Where did this come from? In the first line, you create a reference to a story. If you look at the object model viewer listing of the properties of a story, do you see textExportPreferences? No. TextExportPreferences exist at the application and document level, but not on a story. You want app.documents.item(0).textExportPreferences.

            myFile = new File(caminhoCollect + "/" + myStories.label + ".txt");
            
            myStories.exportFile(ExportFormat.textType, myFile);

            I don't see anything obviously wrong with the above lines.

            Thanks,

            Ole