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

Jump to pages

Community Beginner ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

I have multiple master pages that have other master pages applied to some of them. I'd like to jump to the first document page that has been applied the current active master page. For example, I have a master page Project AB that has the master page A applied to it, and I have a document page '1' that has Project AB applied to the document page '1'. When I'm on master page Project AB, I want to jump to page '1'. Could this be achieviable via script? I've seen the other ways but not this way.

TOPICS
How to , Scripting

Views

926

Translate

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

correct answers 1 Correct answer

Community Expert , Feb 23, 2023 Feb 23, 2023

Hi @Rachel28371239g14w, please try this script:

var doc = app.activeDocument,
    activeSpread = doc.layoutWindows[0].activeSpread,
    spreads = doc.spreads;

if (activeSpread.constructor.name == 'MasterSpread') {
    for (var i = 0; i < spreads.length; i++) {
        if (spreads[i].appliedMaster === activeSpread) {
            doc.layoutWindows[0].activeSpread = spreads[i];
            break;
        }
    }
}

If it works they way you want, you could assign a keyboard shortcut to it.

- Mark

Votes

Translate

Translate
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Yes, easy, but I'm not fluent in JS, so you need to wait for someone else 😞

 

Votes

Translate

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 ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Hi @Rachel28371239g14w, please try this script:

var doc = app.activeDocument,
    activeSpread = doc.layoutWindows[0].activeSpread,
    spreads = doc.spreads;

if (activeSpread.constructor.name == 'MasterSpread') {
    for (var i = 0; i < spreads.length; i++) {
        if (spreads[i].appliedMaster === activeSpread) {
            doc.layoutWindows[0].activeSpread = spreads[i];
            break;
        }
    }
}

If it works they way you want, you could assign a keyboard shortcut to it.

- Mark

Votes

Translate

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 Beginner ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

This is fantastic! Just wondering if it's possible to make it applicable to those masters that have other masters applied to it? For instance, I have a master C that have master B applied to it, and master B has master A applied to it.

Votes

Translate

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 ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

So how does it work? In your example you said if AB-Master is active, then go to page 1, which has AB-Master applied. Are you saying that if A-Master is active, then go to the first page that has any A-Master or any "master-children" applied to it? So if A-Master is active, or if AB-Master is active, script would go to page 1?

Votes

Translate

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 Beginner ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

No, sorry about the confusion! Your script works exactly the way I wanted. It's just that if the AB-Master has another master page applied to it, let's say C, it jumps correctly to page 1 which has AB applied to page 1. But, it won't jump to page 1 if C also has another master BG applied to it. So, it currently only works if the master AB has only one other master applied to it, but I have BG -> C -> AB applied in this order and it only jumps if C -> AB. If that makes sense!

Votes

Translate

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 ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Sorry @Rachel28371239g14w, I'm still having trouble understanding! Could you please set up a little sample document, with the master pages that you want to be able to handle, and a bunch of pages with different masters applied, and post that .indd file here for me to look at, and also post a list of, for example:

 

A-Master should go to page 1

B-Master should go to page 3

AB-Master should go to page 2

C-Master should go to page 2

etc.

 

This will help me a lot! 🙂

- Mark

Votes

Translate

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 Beginner ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Sure! I've made the doc for you to see. 

 

AB to page 1

ii to page 2

uu to page 3

 

I hope this is a better explanation. Thank you for looking into this!

Votes

Translate

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 ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Hi @Rachel28371239g14w, thanks, that is exactly what I need. However, when I run my script on your sample document I get the following results:

When AB is the active page, script goes to page 1
and when ii is active page, script goes to page 2
and when uu is active page, script goes to page 3

... which is what you expect.

 

So what happens when you run the script on your sample document? Also can you tell me your Indesign version and OS (Windows or Mac?). Maybe there is something different happening on your system.

- Mark

Votes

Translate

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 ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

... or are you already telling me what the script is doing? In that case, please tell me when you want the script to do when it runs while each master page is active. Sorry if I misunderstood. 🙂

Votes

Translate

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 Beginner ,
Feb 24, 2023 Feb 24, 2023

Copy link to clipboard

Copied

Oops, I tried it again and it works just fine. Sorry, my bad.

Thanks a lot for your help, Mark. Really appreciate it!

Votes

Translate

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 ,
Feb 24, 2023 Feb 24, 2023

Copy link to clipboard

Copied

LATEST

Haha all good! Happy to help. 🙂

Votes

Translate

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