Question
Help understanding page bounds so they can automatically adjust to selected page? Or...spread??
I have a script for generating guides based on an array
var pagey1 = app.activeWindow.activePage.bounds[0];
var pagex1 = app.activeWindow.activePage.bounds[1];
var pagey2 = app.activeWindow.activePage.bounds[2];
var pagex2 = app.activeWindow.activePage.bounds[3];
for (var i = 0; i < 20; ++i) {
app.activeWindow.activePage.guides.add({name:"Blah"+i, location: (pagex2-pagex1)*Number(fractalSubdivisions[i])+pagex1, orientation: HorizontalOrVertical.VERTICAL});
}
And this is really tripping me up because I know there's a simple formula or command that does what I want to do, but I have no clue how to do it.
So, I'm trying to draw guides on *whichever* page *happens* to be *actively selected*.
Now, the .bounds[...] command returns x1,y1,x2,y2. What is x1 and y1 and x2 and y2 in this case for a two page spread? If someone can explain that, perhaps I can work this out.
Right now, the problem with the script is that it doesn't distinguish between the first page of a two-page spread and the second page of a two-page spread, and I have no clue why.
I thought x1 was the upper-right corner or origin of a given actively selected page. If that were true, that would solve this right away, because I could select page1 of a spread and draw the guides on the correct page, or alternatively, select page 2 and draw the guides on page 2 because each guide would be offset to the right by page2's origin.
But alas, this appears not to be the case.
Now, the .bounds[...] command returns x1,y1,x2,y2. What is x1 and y1 and x2 and y2 in this case for a two page spread? If someone can explain that, perhaps I can work this out.
Right now, the problem with the script is that it doesn't distinguish between the first page of a two-page spread and the second page of a two-page spread, and I have no clue why.
I thought x1 was the upper-right corner or origin of a given actively selected page. If that were true, that would solve this right away, because I could select page1 of a spread and draw the guides on the correct page, or alternatively, select page 2 and draw the guides on page 2 because each guide would be offset to the right by page2's origin.
But alas, this appears not to be the case.
