Skip to main content
Participant
July 14, 2008
Question

Text frames to new layer

  • July 14, 2008
  • 3 replies
  • 737 views
I have a book which has all the frames on one layer (text and graphics), most of the graphics frames have an object style applied to them but none of the text frames do. I need to move all the text frames to a new layer. Is there a script that will do this?

Thanks in advance.
This topic has been closed for replies.

3 replies

Peter Kahrel
Community Expert
Community Expert
July 14, 2008
It's probably mustard after the meal, but you can unlock all text frames before doing anything else:

app.activeDocument.textFrames.everyItem().locked = false;

Groups could be handled as well, but that's a bit more involved.

Peter
Participant
July 14, 2008
Thanks Peter, that works brilliantly. Locked or grouped items will not move, and cause an error, but fortunately there are only a small number of those.
Known Participant
July 14, 2008
if you will iterate all elements - rather using .everyItem() - you can use try { } catch()

(sorry - I'm not JS man)

robin

--
www.adobescripts.com
Peter Kahrel
Community Expert
Community Expert
July 14, 2008
This should work:

L = app.activeDocument.layers.item ('Layer 2');
app.activeDocument.textFrames.everyItem().itemLayer = L;

Change Layer 2 in the first line to the name of your text layer. This affects all textframes in the document, including those on master pages.

Peter