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

How do i specify which page to put the guides on?

Participant ,
Jan 08, 2018 Jan 08, 2018

Hello all!

I am relatively new to scripting, and I am writing a script but need a little help with it. I created the script below, but don't know how to specify which page to put the guides on. Could somebody please give me a little guidance? I would like the script to automatically put the guides on the active page. Does that make sense? Below is my code. Thanks soo much!!

#target "InDesign"

var myDocument = app.activeDocument;

var myPage = myDocument.pages.item(0);

//Set the measurement units to inches.

myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;

myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;

//Create variables.

var myPageWidth = myDocument.documentPreferences.pageWidth;

var myPageHeight = myDocument.documentPreferences.pageHeight;

var mySecondVerticalGuideLocation = myPageWidth/1.6180339887;

var myFirstVerticalGuideLocation = myPageWidth-mySecondVerticalGuideLocation;

var mySecondHorizontalGuideLocation = myPageHeight/1.6180339887;

var myFirstHorizontalGuideLocation = myPageHeight-mySecondHorizontalGuideLocation;

with(myDocument.pages.item(0)){

//Place the two vertical guides.

    guides.add(undefined, {orientation:HorizontalOrVertical.vertical,

    location:(myPageWidth/1.6180339887)});

    guides.add(undefined, {orientation:HorizontalOrVertical.vertical,

    location:(myFirstVerticalGuideLocation)});

//Place the two horizontal guides.

    guides.add(undefined, {orientation:HorizontalOrVertical.horizontal,

    location:(myPageHeight/1.6180339887)});

    guides.add(undefined, {orientation:HorizontalOrVertical.horizontal,

    location:(myFirstHorizontalGuideLocation)});

}

TOPICS
Scripting
656
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

Enthusiast , Jan 08, 2018 Jan 08, 2018

If you want actual page (current page) don't use pages.items(0). Use,

instead, app.activeWindow.activePage

Em 8 de jan de 2018 15:13, "Awitmer" <forums_noreply@adobe.com> escreveu:

Adobe Community <https://forums.adobe.com/?et=watches.email.thread>

How do i specify which page to put the guides on?

criado por Awitmer

<https://forums.adobe.com/people/Awitmer?et=watches.email.thread> em *InDesign

Scripting* - Visualize a discussão completa

<https://forums.adobe.com/message/10088127?et=watches.email.thread#

...
Translate
Enthusiast ,
Jan 08, 2018 Jan 08, 2018

If you want actual page (current page) don't use pages.items(0). Use,

instead, app.activeWindow.activePage

Em 8 de jan de 2018 15:13, "Awitmer" <forums_noreply@adobe.com> escreveu:

Adobe Community <https://forums.adobe.com/?et=watches.email.thread>

How do i specify which page to put the guides on?

criado por Awitmer

<https://forums.adobe.com/people/Awitmer?et=watches.email.thread> em *InDesign

Scripting* - Visualize a discussão completa

<https://forums.adobe.com/message/10088127?et=watches.email.thread#10088127>

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 ,
Jan 08, 2018 Jan 08, 2018
LATEST

Awesome! This is exactly the info I needed to know. I will mark this answer as correct.

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