Copy link to clipboard
Copied
Hi,
I am running Illustrator 28.0 on Mac OS 13.6.1.
I am currently flowing varied text in to a text box, and wondered if there was a way in which I could identify the linesbreaks within the text box. So I would want to be able to recognise once the text is flown in the words 'the_' and 'Sat_'. The reason for this is so I can potentially identify with coding and manipulate actions when a linebreak is created.
Thanks
Steve
This should output a list of words at line breaks (but not paragraph breaks). A text frame should be selected.
var output = "";
var paragraphs = app.selection[0].paragraphs;
for (var i = 0; i < paragraphs.length; i++) {
var lines = paragraphs[i].lines;
for (var j = 0; j < lines.length - 1; j++) {
var index = lines[j].words.length - 1;
output += lines[j].words[index].contents + "\n";
}
}
alert(output);
Copy link to clipboard
Copied
This should output a list of words at line breaks (but not paragraph breaks). A text frame should be selected.
var output = "";
var paragraphs = app.selection[0].paragraphs;
for (var i = 0; i < paragraphs.length; i++) {
var lines = paragraphs[i].lines;
for (var j = 0; j < lines.length - 1; j++) {
var index = lines[j].words.length - 1;
output += lines[j].words[index].contents + "\n";
}
}
alert(output);
Copy link to clipboard
Copied
Thank you so much femkeblanco
That worked perfectly