Site logo

Override

Override all pageItems function

Override elements by script problems

InDesign Applescript: 'override master page items' glitch?


Example of overriding a text frame with a specific label

Main();

function Main() {
	var doc = app.activeDocument,
	page = doc.pages[0],
	frameYear = GetItemFromCollection("Year", page.appliedMaster.allPageItems);
	
	if (frameYear != null) {
		if (frameYear.parentPage.side == page.side) {
			var result = frameYear.override(page); // result = textFrame
		}
	}
}

function GetItemFromCollection(label, collection) {
	for (var i = 0; i < collection.length; i++) {
		if (label == collection[i].label) return collection[i];
	}
	return null;
}