Export all text
A little reworked sample script for InDesign CS3.
Exports all the text in the active document on a page-by-page basis as a single text file. To do this, the script will create a new document, combine the stories in the new document using export/import, and then export the text from the new document.
The InDesign CS3 Scripting Guide comes with a simple script for exporting all text in a document to a single output file, but it requires that you enter a file path in the script for both the exported text file and for a temporary file it creates. Here's a version that shows how to add a user interface to this script (and demonstrates using the Folder.temp property to find the temporary items folder).
Click here to download the script.
See also Rorohiko's TextExporter.