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

Changing page item stacking order

Participant ,
Jul 23, 2024 Jul 23, 2024

Hi all, I need a javascript method to replicate the following, as seen in the Photoshop and Illustrator object models:

pageItem.move( relativeObject, ElementPlacement )

 

I feel like I'm missing something obvious, but I've been looking for a while. Surely someone has tried to do this before?

TOPICS
Scripting
727
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 , Jul 23, 2024 Jul 23, 2024

pageitem.bringToFront() will bring it to the top of layer, sendToBack() at bottom of layer. You can pass another pageitem reference to bring object in front or behind it.

Translate
Community Expert ,
Jul 23, 2024 Jul 23, 2024

pageitem.bringToFront() will bring it to the top of layer, sendToBack() at bottom of layer. You can pass another pageitem reference to bring object in front or behind it.

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 ,
Jul 23, 2024 Jul 23, 2024

This is perfect. Thank you!

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 ,
Jul 23, 2024 Jul 23, 2024

Hi @nickcombs, wow I can't believe I've never noticed this before! You're right that Indesign's PageItem.move doesn't work like Illustrator/Photoshop. It seems to only allow you to move to a new Layer, Page, Spread or Document. Best I could find quickly was to use another layer and shuffle the items back and forth to adjust the order. Not great. Hopefully someone will have a better idea!

- Mark

 

Edit: Thanks @brian_p_dts!

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 ,
Jul 23, 2024 Jul 23, 2024

Do you mean to tell me that ID, PS and AI APIs have practically nothing in common?!?! Perish the thought 😆 

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
LEGEND ,
Jul 23, 2024 Jul 23, 2024

@nickcombs

 

InDesign doesn't offer direct access to the Z-order. 

 

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 ,
Jul 24, 2024 Jul 24, 2024
LATEST

Hi @nickcombs , there’s also bringForward() and sendBackward(), which moves the object up or down the z-order.

 

//move the selected object up
app.activeDocument.selection[0].bringForward()
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