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

Line to column , comma separator

Engaged ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Hello!

I have a textframe

bla1,bla2,bla3 bla4

I want a script to transform selected textframe  it to column

bla1

bla2

bla3

bla4

The separator is comma or white space

Any ideas?

TOPICS
Scripting

Views

180

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

Community Expert , Oct 26, 2020 Oct 26, 2020

Hi,

Try following

var _textFrame = app.selection[0];
var data = _textFrame.contents.split(',');  // Use white space as a separtor if it is white space
_textFrame.contents = '';
for (var i = 0; i < data.length; i++) {
    _textFrame.contents = _textFrame.contents + data[i] + "\r";
}

 

Make sure to select the textframe before running the above script.

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

Hi,

Try following

var _textFrame = app.selection[0];
var data = _textFrame.contents.split(',');  // Use white space as a separtor if it is white space
_textFrame.contents = '';
for (var i = 0; i < data.length; i++) {
    _textFrame.contents = _textFrame.contents + data[i] + "\r";
}

 

Make sure to select the textframe before running the above script.

Best regards

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
Engaged ,
Oct 26, 2020 Oct 26, 2020

Copy link to clipboard

Copied

LATEST

It is working great, thanks!

Best regards

 

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