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

Move a selected item to a specific layer

Participant ,
May 26, 2022 May 26, 2022

Hoping someone can help me with a script.

 

I always have a layer called "contents" in my indesign files. Sometimes I have an object on another layer that needs to be on this "contents" layer. It will speed up my process if I can script this (to assign a shortcut) so I dont have to drag the coloured dot in the layers panel to another layer. Is there a way to script this?

 

I saw another post with a script from Jongware but it doesn't seem to work for me. Thanks. 

TOPICS
Scripting
588
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 , May 27, 2022 May 27, 2022

Hi @danielw42205661,

How do we identify the object that needs to be moved? If it's named then the following script should work. Here I am assigning the object with name movetf to the layer named contents

 

 

app.documents[0].pageItems.itemByName("movetf").itemLayer = app.documents[0].layers.itemByName("contents")

 

 

If there is any other criteria for choosing the object then we will have to tweak the code.

Edit:- I see you talk about selection, so if you want to move the selected object to the

...
Translate
Community Expert ,
May 27, 2022 May 27, 2022

Hi @danielw42205661,

How do we identify the object that needs to be moved? If it's named then the following script should work. Here I am assigning the object with name movetf to the layer named contents

 

 

app.documents[0].pageItems.itemByName("movetf").itemLayer = app.documents[0].layers.itemByName("contents")

 

 

If there is any other criteria for choosing the object then we will have to tweak the code.

Edit:- I see you talk about selection, so if you want to move the selected object to the contents layer then the following should work

 

app.selection[0].itemLayer = app.documents[0].layers.itemByName("contents")

 

P.S.:- The code does not have any error checks

-Manan

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
Participant ,
May 27, 2022 May 27, 2022
LATEST

Thank you so much, Manan. Works exactly as I'd hoped 🙂 

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