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?

TOPICS
Scripting

Views

50

Likes

Translate

Translate

Report

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

1 Correct Answer

Adobe Community Professional , Oct 26, 2020
Charu Rajput Adobe Community Professional , 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.

Likes

Translate

Translate
Jump to answer Jump to answer
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
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
siomosp AUTHOR LATEST
Explorer ,
Oct 26, 2020

Copy link to clipboard

Copied

It is working great, thanks!

Best regards

 

Likes

Translate

Translate

Report

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