How do i specify which page to put the guides on?
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)});
}
