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

Script to move all text objects to another Layer

New Here ,
Jun 19, 2014 Jun 19, 2014

Hi ,

I need a script that moves all text objetcs to another layer.

The layer is already created, i managed to access the text objects.

How can i move them to a specific layer ?

Thanks

Audrey

for(var e = 0;e<doc.textFrames.length;e++){

    var frame =  doc.textFrames;

WRITE HERE HOW TO MOVE TO ANOTHER LAYER

            

       }

TOPICS
Scripting
929
Translate
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 , Jun 19, 2014 Jun 19, 2014

Hi audrey12345,

for things like this it's very important, where your destination layer is.

 

If your destination layer is above all other layers (with text frames) you can loop "e++" like this:

 

var doc = app.activeDocument;
var Layer2Move = doc.layers.getByName ("YourLayerName");
for( e = 0;e <= doc.textFrames.length-1;e++) {
    doc.textFrames[e].moveToEnd(Layer2Move);
}
 

 

If not, you have to loop backwards "e--".

If destination layer is between other layers - this method is unsuitable.

 

H

...
Translate
Adobe
New Here ,
Jun 19, 2014 Jun 19, 2014

Using javascript please.

Translate
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 ,
Jun 19, 2014 Jun 19, 2014

Hi audrey12345,

for things like this it's very important, where your destination layer is.

 

If your destination layer is above all other layers (with text frames) you can loop "e++" like this:

 

var doc = app.activeDocument;
var Layer2Move = doc.layers.getByName ("YourLayerName");
for( e = 0;e <= doc.textFrames.length-1;e++) {
    doc.textFrames[e].moveToEnd(Layer2Move);
}
 

 

If not, you have to loop backwards "e--".

If destination layer is between other layers - this method is unsuitable.

 

Have fun

Translate
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 ,
Jan 24, 2023 Jan 24, 2023

Is there an update for the above question that works in January 2023?

Mike Witherell
Translate
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 ,
Jan 24, 2023 Jan 24, 2023

Here you go. When the forums migrated recently, a lot of old posts that included code snippets mysteriously had the brackets and index variables removed from loops..

var doc = app.activeDocument;
var Layer2Move = doc.layers.getByName ("YourLayerName");
for( e = 0;e <= doc.textFrames.length-1;e++) {
    doc.textFrames[e].moveToEnd(Layer2Move);
}
Translate
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 ,
Jan 24, 2023 Jan 24, 2023
LATEST

Thank you so much! Just what I needed.

Mike Witherell
Translate
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