Skip navigation
Currently Being Moderated

Export InDesign file as text

Apr 28, 2012 2:04 AM

Hi All,

 

I need to export InDesign file as text (textType). There are several examples of this but I couldn't found the script which export InDesign file as text in active Indesign document path with indesign file name.

 

For Example: If file is MyDoc.indd, export text file name should be MyDoc.txt.

 

If anybody have this code, please provide me.

 

Thanks,

Chang

 
Replies
  • Currently Being Moderated
    Apr 28, 2012 6:41 AM   in reply to Chang_indd

    This is not entirely straightforward because InDesign exports stories, not documents, to text. So you need to collect the contents of all stories, figure out what order they should be (that's the hard part), combine them, and then export to text. See www.rorohiko.com for an example.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 1:28 AM   in reply to Chang_indd

    >What is the js code for exports stories with active InDesign file name in designated folder?

     

    You realise that your second story "with the active InDesign file name" would overwrite your first story with that same file name?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 30, 2012 2:08 AM   in reply to Chang_indd

    Talking around in circles, aren't we? See anwser #1 above!

     

    But, suit yourself. This does what you are asking:

     

    app.activeDocument.stories[0].exportFile(ExportFormat.TEXT_TYPE, new File(app.activeDocument.fullName.fullName.replace(/\.indd$/i,'')+".txt"));
    
     
    |
    Mark as:
  • Currently Being Moderated
    May 1, 2012 1:02 PM   in reply to Chang_indd

    Check out this script

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points