Use the second method and do something like this:
// Textdatei_auslesen.jsx // a txt file on ~/Desktop is required // regards pixxxelschubser var myFile = File ('~/Desktop/test.txt'); myFile.open("r"); var contentString = myFile.read(); myFile.close(); alert (contentString); // or do something else
This works good with *.txt, but not with *.doc
Thanks for your reply. That's basically what I have been doing for now. Except the strange thing is, when I alert(contentString) it displays it correctly with all of the line breaks. However, when I set the contents of a text frame object equal to it, such as
myTextFrame.contents = contentString;
the new lines/carriage returns go away and I am left with one big block of text (with spaces). I found a work around by reading the .txt file in line by line using .readln() and adding carriage returns where necessary so that's fine.
BUT I still would like a solution with word files (i.e. doc). Does anyone have any ideas?
You would have to add a rectangle and make it a textFrame object in order for the text to act like you want.