Copy link to clipboard
Copied
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)});
}
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#
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
Awesome! This is exactly the info I needed to know. I will mark this answer as correct.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more