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?
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.
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.
Copy link to clipboard
Copied
It is working great, thanks!
Best regards