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

Trying to Export All Document Stories to RTF via Scripting

Enthusiast ,
Dec 25, 2021 Dec 25, 2021

Copy link to clipboard

Copied

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

Views

448

Translate

Translate

Report

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

Guru , 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

Votes

Translate

Translate
Community Expert ,
Dec 25, 2021 Dec 25, 2021

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@Peter Kahrel  Thanks a lot

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@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

Votes

Translate

Translate

Report

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
Guru ,
Dec 25, 2021 Dec 25, 2021

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@Kasyan Servetsky 

Thanks a lot, yes thats help a lot

 

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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?

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Screenshot 2024-03-01 at 8.57.50 AM.png

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Tag the script author's name: @Kasyan Servetsky 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

@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. 

 

▒► ID-Tasker / ID-Tasker Server - work smart not hard ◄▒

Votes

Translate

Translate

Report

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
Guru ,
Mar 04, 2024 Mar 04, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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