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

Problem selecting spread in a script

Explorer ,
Jul 16, 2023 Jul 16, 2023

Copy link to clipboard

Copied

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

Views

131
Translate

Report

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
Community Expert ,
Jul 16, 2023 Jul 16, 2023

Copy link to clipboard

Copied

The spread is the .parent of the activePage: 

Votes

Translate

Report

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
Explorer ,
Jul 16, 2023 Jul 16, 2023

Copy link to clipboard

Copied

LATEST

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? 

Votes

Translate

Report

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