Question
Illustrator and scripting inconsistent words[] when tabs used
Can someone explain the results when the following is run on an Illustrator document with one text frame?
var myDoc = app.activeDocument;
var myTextFrame = myDoc.textFrames[0]
myTextFrame.contents = "Lorem ipsum dolor sit amet\rLorem\tipsum\tdolor\tsit\tamet";
alert(myTextFrame.words.length);
alert(myTextFrame.lines[0].words.length);
alert(myTextFrame.lines[1].words.length);
for (l=0; l<2; l++)
{
concat = "#";
for (i=0; i<myTextFrame.lines[l].words.length; i++)
{
concat += myTextFrame.lines[l].words[i].contents;
concat += "#";
}
alert(concat);
}
14
5
9
#Lorem#ipsum#dolor#sit#amet#
#Lorem#Lorem#ipsum#ipsum#dolor#dolor#sit#sit#amet#
Why does separating the words by tabs seem to duplicate all but the last word in the line?
Is this a bug, and if not, what is the logic behind it?
I believe I have the latest version of Illustrator downloaded via CC
