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
}
1 Correct answer
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
...Explore related tutorials & articles
Copy link to clipboard
Copied
Using javascript please.
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
Copy link to clipboard
Copied
Is there an update for the above question that works in January 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);
}
Copy link to clipboard
Copied
Thank you so much! Just what I needed.

