Copy link to clipboard
Copied
I want to select all text content of every page in an InDesign document or copying all text in InDesign document. I have tried scripting method, but did not work.
Copy link to clipboard
Copied
Have a look at Text Exporter: https://www.rorohiko.com/wordpress/indesign-downloads/textexporter-4/
Copy link to clipboard
Copied
In addition to Derek's suggestion you might want to look at https://redokun.com/blog/indesign-to-word to see how to use a pdf exported from InDesign to Acrobat and then from there directly to a Word Document.
Copy link to clipboard
Copied
Hello Karky5EA7,
The below script will write all the text from a InDesign document to a single .txt file, saving the .txt file to the same location as the Indesign document.
doc = app.documents[0];
var fileName = doc.name.replace(/.indd$/i, "");
var path = doc.filePath;
var myTextFilename = fileName + '_TEXT.txt';
allStorys = [];
var allStoriesArray = app.documents[0].stories.everyItem().getElements();
for(var n=0; n<allStoriesArray.length; n++){
allStorys.push(allStoriesArray[n].contents);
}
var myText = allStorys;
var file = new File(path +'/' + myTextFilename);
file.encoding = 'UTF-8';
file.open('w');
file.write(myText);
file.close();
alert('Done writing the text!')
Regards,
Mike