Mobile app version of vmapp.org
Login or Join
Welton168

: Indesign: Find which pages apply certain masters 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

@Welton168

Posted in: #AdobeIndesign #MasterPage

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton168

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo857

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 »

// Version 2
// 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:
// 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. lineline Sub masters are shown in parenthesis. i0 linelineline');

// 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 directlyi0' : '' ) +'.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 +'lineline';
txt_file.writeln( f );

}

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

// Opens the text file
txt_file.execute();

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme