4

I couldn't find this on my own. Using InDesign CC, I have set up 17 masters and +100 pages on a document.

Hovering over a page will tell me which master it has applied to it. Ideally, the converse would be great, but hovering over a master doesn't tell me anything. How can I quickly find out which pages have a certain master applied to them?

Thanks

2
  • in the Panel Options, if you turn off the preview you will just see the letter for the Master instead of the page preview thumbnails. Is that about what you're trying to see?
    – Rsiel
    Jul 14 '14 at 16:54
  • Not exactly, the way you suggest just shows me "A" or "B", and not the specific master name applied to it.
    – newyuppie
    Jul 14 '14 at 22:25
2

Just save it in the indesign script folder as "Master Page Numbers.jsx" and run it with a document open.

Edit: I updated the script.

Now you just run the script and it will save/open a text file with the information about every master.

Click to view bigger version of the image » enter image description here

// Version 2
// https://gist.github.com/joonaspaakko/efc6eb11759965d54b20

// Tested in Mac - Indesign CC 2014

// Future improvements... mmaybe?
// - Adding colors to the text file. Just a little something something to help with the reading.

// Version 2
// Changelog:
// - Now prints out the page information about every single page in the document.
// - Removed the dialog, as it's useless now.
// - Due to the increased number of text printed out at once, it is now printed into a rtf file.

// If dialogs are your thing, you can still find the old version here:
// https://gist.github.com/joonaspaakko/efc6eb11759965d54b20/02a53c865ec1f228b1646d4dbe558c5ccfa94040

// Current document
var doc = app.documents[0];
var docName = doc.name;

// List of master pages
var docMasters = doc.masterSpreads.everyItem().name;

// Creates same amount of arrays as there are masters ( [None] is also included ).
// The arrays are populated later on.
var masters_array = {};
for ( i=0; i <= docMasters.length; i++ ) {
masters_array[i] = [];
}

var pagesLength = doc.pages.length;

// Loop through all pages...
for ( var i = 0; i < pagesLength; i++ ) {

// Currently active page
var active_page = doc.pages[ i ];

// Name of the master in currently active page
var active_pageMaster = active_page.appliedMaster ? active_page.appliedMaster.name : '[None]';

// Index of the master in currently active page
var active_pageMasterIndex = active_page.appliedMaster ? active_page.appliedMaster.index + 1 : 0;
var ami = active_pageMasterIndex;

// Push page numbers to their respective arrays...
masters_array[ami].push( ' ' + ( i+1 ) ); // i+1 === active_page.index + 1 ( So this is where the page numbers are pushed to the arrays )

};

var filepath = "~/Desktop/"+docName+"_Master_Pages.rtf";
var txt_file = new File( filepath );
txt_file.open( "w" );

// If master has a sub master, it is pushed here later on.
var subMaster_array = {};

// First line in the text file
txt_file.writeln('{\\line \\i If you ran the script with this text file open, you may need to re-open it to see the changes. \\line\\line Sub masters are shown in parenthesis. \\i0 \\line\\line\\line');

// Xerox
var print = {}

// Loop through the masters yet again
// The point of this is to assing the correct heading to each line and their sub master info.
for ( i=-1; i < docMasters.length; i++ ) {

var none = i === -1;

// Get the current line heading
var heading = none ? '[None]' : doc.masterSpreads[ i ].name;

// Check if current master has sub master
// [None] is never able to have sub masters, since it is not a master
var appliedMaster = none ? null : doc.masterSpreads[ i ].appliedMaster;

// Check the sub master name, if the current master has a sub master.
var appliedMasterName = !appliedMaster ? null : doc.masterSpreads[ i ].appliedMaster.name;

// Find out which master is applied to current master
print.subMaster = appliedMaster ? ' ( '+ appliedMasterName +' )' : '';

var currentMaster = masters_array[ i+1 ];
var subMasterOf = subMaster_array[ i+1 ];

// Prints pages in the current master or if it has not been applied to any page, it prints out the text string.
// In addition to the page numbers, it also prints the sub master of that specific master in parenthesis, if it has any.
print.pages = currentMaster == '' ? '\\i Has not been applied to any page'+ ( subMasterOf ? '\\i directly\\i0' : '' ) +'.\\i0': currentMaster,

// If current master is applied to another master, this prints out the name of that other master.
print.parentMaster = ( subMasterOf == null ? '' : '\\b Sub master of: \\b0 ' + subMasterOf );

// Make an array with the applied master index and store the current master name
appliedMaster && subMaster_array[ doc.masterSpreads[ i ].appliedMaster.index + 1 ] = [ doc.masterSpreads[ i ].name ];


// Writes the text body...
var f = '\\b ' +heading +'\\b0 '+ print.subMaster +'\\b:\\b0 '+ print.pages + print.parentMaster +'\\line\\line';
txt_file.writeln( f );

}

txt_file.writeln('}');
txt_file.close();

// Opens the text file
txt_file.execute();
4
  • THIS IS EXACTLY what I was looking for, and I can't believe it isn't there by design :O. I've successfully installed it and it's working as expected! THANKS!
    – newyuppie
    Jul 14 '14 at 22:30
  • 1
    @newyuppie You're welcome. It does seem like a thing that could have been easy for adobe to implement, but at the same time, I couldn't really think of a situation where I would need such list. Out of curiosity, can you say what you need it for?
    – Joonas
    Jul 14 '14 at 22:36
  • I wanted to know which pages exactly would be affected if I deleted a couple of masters that I thought were redundant.
    – newyuppie
    Jul 15 '14 at 23:12
  • @newyuppie Oh yeah. When you try to delete a master, it does say that the master is in use, if it is, but it doesn't say where.
    – Joonas
    Jul 15 '14 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.