Skip to main content
Known Participant
September 14, 2011
Question

need script to export text from multiple illustrator files to txt files

  • September 14, 2011
  • 1 reply
  • 2143 views

Hello.

I can do the following manually:

open an illustrator file (cs4, pc, windows xp); go to file, export, export text to a file with the same name as the illustration file (with the txt extension).

that results is a text file with all the call outs from my illustration in one text file. great.

however, i have hundreds of illustration files. I need to extract out the text for each file and save to text files for each. (as an aside, I wouldn't mind an option that would append text within one txt file; that is, allow me to list the source file "Illustration 201.ai; c/drawings... " followed by lines of text; followed by the next file name... followed by the next lines of text... etc.)

Does anyone know of a script that will do this in a batch mode?

Thanks in advance

RP

This topic has been closed for replies.

1 reply

Larry G. Schneider
Community Expert
Community Expert
September 14, 2011

Here's one from I think Carlos Canto or Muppet Mark  to get you started

#target illustrator

var textFile = File('~/Desktop/AI.txt');

var doc = app.activeDocument;

var docText = '';

for (var i = 0; i < doc.textFrames.length; i++)
     {
          docText += doc.textFrames.contents + '\r';
     }

textFile.open('e');

textFile.write(docText);

textFile.close();