Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Trying to Export All Document Stories to RTF via Scripting

Enthusiast ,
Dec 25, 2021 Dec 25, 2021

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(); 

 

 

 

Best
Mohammad Hasanin
TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Dec 25, 2021 Dec 25, 2021

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

KasyanServetsky_0-1640466790359.png

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

Translate
Community Expert ,
Dec 25, 2021 Dec 25, 2021
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 25, 2021 Dec 25, 2021

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

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 25, 2021 Dec 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 25, 2021 Dec 25, 2021

@Peter Kahrel  Thanks a lot

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 25, 2021 Dec 25, 2021

@Peter Kahrel  But Version 4 is Extension!/Plugin , and with this way i will not be able to continue my script developing, unlucky this is not what i was seeking for!, please advice me?

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Dec 25, 2021 Dec 25, 2021

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

KasyanServetsky_0-1640466790359.png

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Dec 25, 2021 Dec 25, 2021

@Kasyan Servetsky 

Thanks a lot, yes thats help a lot

 

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 01, 2024 Mar 01, 2024

I am trying to get this script to work in 2024. I am getting errors. Does anyone know how to make it work in newer versions?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 01, 2024 Mar 01, 2024

Screenshot 2024-03-01 at 8.57.50 AM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 03, 2024 Mar 03, 2024

Tag the script author's name: @Kasyan Servetsky 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 03, 2024 Mar 03, 2024

@HB44

 

Something went wrong when you extracted jsx file from the zip package - the line with the error should be like this:

 

myStory = myPage.textFrames[t].parentStory;

 

[t] is missing. 

 

You should try to extract it again. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 04, 2024 Mar 04, 2024
LATEST

@HB44You're trying to run an old & buggy version. Make sure to download the latest version from my site here. Note there's _CS3 in the file name (instead of _Kas). Though it was written for CS3, it still works in version 19.1 — just tested it on my Mac.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines