Copy link to clipboard
Copied
Is this possible to access the master page via name without prefix.
Via scripting, sure.
Edit: Adjusted the object name, thanks to Uwe.
var getMasterByName = function(searchString, doc) {
for (var i = 0; i < doc.masterSpreads.length; i++) {
if (doc.masterSpreads[i].name.indexOf(searchString) >= 0) {
return doc.masterSpreads[i];
}
}
Copy link to clipboard
Copied
Via scripting, sure.
Edit: Adjusted the object name, thanks to Uwe.
var getMasterByName = function(searchString, doc) {
for (var i = 0; i < doc.masterSpreads.length; i++) {
if (doc.masterSpreads[i].name.indexOf(searchString) >= 0) {
return doc.masterSpreads[i];
}
}
Copy link to clipboard
Copied
FWIW: There is no masterPages collection with Document.
But one could build an array:
var masterPagesArray =
app.documents[0].masterSpreads.everyItem().pages.everyItem().getElements();
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Ack, did it on mobile without checking the DOM! I was just working on a master page script, too... Thanks, Uwe.