Highlighted

Line to column , comma separator

Explorer ,
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?

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

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.

TOPICS
Scripting

Views

28

Likes

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

Line to column , comma separator

Explorer ,
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?

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

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.

TOPICS
Scripting

Views

29

Likes

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
Oct 26, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Oct 26, 2020 1
siomosp LATEST
Explorer ,
Oct 26, 2020

Copy link to clipboard

Copied

It is working great, thanks!

Best regards

 

Likes

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
Reply
Loading...
Oct 26, 2020 1
Resources