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

Script to move all text objects to another Layer

New Here ,
Jun 19, 2014 Jun 19, 2014

Copy link to clipboard

Copied

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

Views

749

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

...

Votes

Translate

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

Copy link to clipboard

Copied

Using javascript please.

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

Mike Witherell

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

Copy link to clipboard

Copied

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);
}

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

Copy link to clipboard

Copied

LATEST

Thank you so much! Just what I needed.

Mike Witherell

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