Skip to main content
Known Participant
July 16, 2023
Question

Problem selecting spread in a script

  • July 16, 2023
  • 1 reply
  • 219 views

I have a script that adds guides at proportions of a document's length.

But, it doesn't seem to recognize the active Spread of an active page where there's two spreads joined into a page, ya know, the default. 

 

I use a simple for-loop to draw the guides using proportions defined earlier in the script:

 

for (var i = 0; i < 5; ++i) {
    app.activeWindow.activePage.guides.add({name:"Blah"+i, location: docWidth*Number(fractalSubdivisions[i]), orientation: HorizontalOrVertical.VERTICAL});
}
 
How do I get this code to distinguish between active Page and active Spread?
This topic has been closed for replies.

1 reply

brian_p_dts
Community Expert
Community Expert
July 16, 2023

The spread is the .parent of the activePage: 

Known Participant
July 16, 2023

Hmm, okay, if what you're saying is true, then I must overlooked at the document length is hard-coded for each spread page. I'm drawing guides on the actively selected page, but according to the rulers, the same "length" or "distance" of each guide remains the same regardless of which page is actively selected. 

Is there perhaps code that can get the dimensions of an actively selected page? How do I sort through this to draw guides in whichever page is active of the selected spread?