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

Is there a way to quickly break a single text box into multiple text boxes?

Explorer ,
May 23, 2014 May 23, 2014

Copy link to clipboard

Copied

I was advised to post my issue from the Photoshop section to this section. (*Note: I only have Photoshop, so saying "Use this other Adobe product" isn't a real answer for me.)

C/P from other post here: Is there a way to quickly break a single text box into multiple text boxes?

I have wished for this feature for many years, and I want to know if maybe there is a script that can do this

The scenario:

I have one text box, containing 20 names. I want 20 text boxes, each containing 1 name.

I know how to manually do it, but I want to be able to do this super fast, ie. make the machine do it for me.

Thanks!

SS1.jpg

SS2.jpg

TOPICS
Actions and scripting

Views

2.9K

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 , May 24, 2014 May 24, 2014

I don’t think what you want is convenient to achieve in various possible situations.

Hndling different fonts, sizes and other settings would be highly cumbersome.

If all the text has the same type parameters you can give this a try.

// split lines from active typelayer;

// makes sense if the type properties are uniform;

// 2014, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theLayer = myDocument.activeLayer;

if (theLayer.kind =

...

Votes

Translate

Translate
Adobe
Community Expert ,
May 24, 2014 May 24, 2014

Copy link to clipboard

Copied

I don’t think what you want is convenient to achieve in various possible situations.

Hndling different fonts, sizes and other settings would be highly cumbersome.

If all the text has the same type parameters you can give this a try.

// split lines from active typelayer;

// makes sense if the type properties are uniform;

// 2014, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theLayer = myDocument.activeLayer;

if (theLayer.kind == LayerKind.TEXT) {

// get text an dleading;

var theText = theLayer.textItem.contents.split("\r");

try {

var theLeading = theLayer.textItem.leading;

}

catch (e) {

var theLeading = theLayer.textItem.size * 1.2;

};

var theOffset = 0;

// work off the array;

for (var m = 0; m < theText.length; m++) {

// duplicate layer, change its contents and move it;

var theNewText = theLayer.duplicate(theLayer, ElementPlacement.PLACEBEFORE);

theNewText.textItem.contents = theText;

theNewText.translate(0, theOffset);

// amend offset;

theOffset = theOffset+theLeading

}

}

};

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
Community Expert ,
May 24, 2014 May 24, 2014

Copy link to clipboard

Copied

Paste the code from the previous post into a new file in ExtendScript Toolkit or a text editor and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, be used in a Configurator-Panel or started from ExtendScript Toolkit directly.

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
Community Expert ,
May 26, 2014 May 26, 2014

Copy link to clipboard

Copied

So did the Script work as expected for you?

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
Explorer ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

Perfect! 

As a note to new users, in addition to breaking up the entires, the script seems to generate 2 empty layers (just delete them) and keeps the original (which is useful).

Thanks, c.pfaffenbichler !

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
Community Expert ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

Does your type layer contain blank paragraphs?

Anyways, keep in mind that the resulting type layers will have identical type properties and disregard variance.

So if you had one line in a different font that would be ignored (the font, not the line).

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 ,
Aug 18, 2017 Aug 18, 2017

Copy link to clipboard

Copied

Hi there c.pfaffenbichler

I know you wrote the above answer numerous years ago, but I was wondering if it was possible to do the same script for Illustrator? I have a text box containing many lines of text and I'd love each line as individual points of text (but not individual layers). Is this even possible?

Thanks in advance for your advice and help.

Mjc

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
Community Expert ,
Aug 19, 2017 Aug 19, 2017

Copy link to clipboard

Copied

I assume it might be possible but I have very little familiarity with Illustrator’s DOM, so you may want to ask over at

Illustrator Scripting

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 ,
Aug 19, 2017 Aug 19, 2017

Copy link to clipboard

Copied

I did try your script, but it didn't recognise the layers. Thanks so somuch

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
Community Expert ,
Aug 20, 2017 Aug 20, 2017

Copy link to clipboard

Copied

Illustrator and Photoshop have different DOMs so Scripts that go beyond fairly simple features (like opening files) are unlikely to work in both.

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 ,
Apr 15, 2024 Apr 15, 2024

Copy link to clipboard

Copied

LATEST

Tried your script on Adobe 2022 but unfortunately it only pastes "Array" instead of the actual text, I wonder if I'm doing something wrong. And yes, I know this was made TEN years ago but man would this be time saving.

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