• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
3

Is there a way of recognising linebreaks with a Text Box

New Here ,
Nov 03, 2023 Nov 03, 2023

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_'. Screenshot 2023-11-03 at 14.15.34.pngThe reason for this is so I can potentially identify with coding and manipulate actions when a linebreak is created.

Thanks

Steve

TOPICS
Experiment , How-to , Scripting , Type

Views

143

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Nov 03, 2023 Nov 03, 2023

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);

 

 

 

Votes

Translate

Translate
Adobe
Guide ,
Nov 03, 2023 Nov 03, 2023

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);

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 03, 2023 Nov 03, 2023

Copy link to clipboard

Copied

LATEST

Thank you so much femkeblanco

That worked perfectly

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines