Skip to main content
M.Hasanin
Inspiring
December 25, 2021
Answered

Trying to Export All Document Stories to RTF via Scripting

  • December 25, 2021
  • 2 replies
  • 1376 views

Hi Experts,

Im trying to export all document stories to RTF File, it shouid be simple task but the following script only export one story not all the stories, can you please help to identify the problem? and thanks a lot in advance :

 

 

var myDoc = app.activeDocument
var mystories = myDoc.stories.everyItem();
var nfolder1 = "~/Desktop";
var fName = "myFile";
var nFile=new File("~/Desktop/myFile.rtf");
mystories.exportFile(ExportFormat.RTF, nFile);
alert("Exporting Document to RTF Done!");
if (nFile.exists) 
nFile.execute(); 

 

 

 

This topic has been closed for replies.
Correct answer Kasyan Servetsky

Check out the 'ExportAllStories.jsx' in the \Scripts Panel\Samples\JavaScript folder:

It makes a separate text file for each story.

Here's a script that puts them on a page-by-page basis into a single file. It was made for CS3 but still works in 2022.

Hope it helps!

— Kas

2 replies

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
December 25, 2021

Check out the 'ExportAllStories.jsx' in the \Scripts Panel\Samples\JavaScript folder:

It makes a separate text file for each story.

Here's a script that puts them on a page-by-page basis into a single file. It was made for CS3 but still works in 2022.

Hope it helps!

— Kas

M.Hasanin
M.HasaninAuthor
Inspiring
December 25, 2021

@Kasyan Servetsky 

Thanks a lot, yes thats help a lot

 

Mohammad Hasanin
Derek Cross
Community Expert
Community Expert
December 25, 2021
M.Hasanin
M.HasaninAuthor
Inspiring
December 25, 2021

Thanks a lot @Derek Cross but i just want to do it by script

Mohammad Hasanin
Peter Kahrel
Community Expert
Community Expert
December 25, 2021

Click the link that Derek posted and you'll see this statement:

"TextExporter 4 can export all the stories of an InDesign document into a single file."

It is a script.