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

Inquiries on alignment and drawing guides for scripting

Explorer ,
Jun 21, 2023 Jun 21, 2023

Hi! I have a few script-related questions for InDesign and someone recommended these forums.

There's a couple things I'd like to do, one is to create a panel with buttons and such, and another is to draw guides. I'm learning some basic scripting for drawing a dialog window in InDesign, creating text and buttons and groups and so on.


But, one thing that would be nice is to align things in various ways, and space them out. For any given panel with various horizontal and vertical child elements, is there a way to align things left, center and right? And then also, how do you distinguish between left-right alignment and up-down alignment?

For drawing a guide, the following script seems to hold

 

app.documents[0].pages[0].guides.add ({
  location: 12,
  orientation: HorizontalOrVertical.VERTICAL
});

 

However, I don't want this to be "document 0" and "page 0", I want it to draw a guide on whichever page I coincidentally happen to have selected.

Is there a way to instead draw guides on whatever page and document is actively selected?

TOPICS
Scripting
194
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
Advisor ,
Jun 21, 2023 Jun 21, 2023
LATEST

Hello @dane13860245,

 

Give this a try...

app.activeWindow.activePage.guides.add({location: 12, orientation: HorizontalOrVertical.VERTICAL});

Regards,

Mike

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