Skip to content

Instantly share code, notes, and snippets.

@UskeS
Created March 15, 2022 10:23
Show Gist options
  • Save UskeS/fe837b01d90b3cb1fa33d7ecef4c1f33 to your computer and use it in GitHub Desktop.
Save UskeS/fe837b01d90b3cb1fa33d7ecef4c1f33 to your computer and use it in GitHub Desktop.
[InDesign] ページ上半分のマスターページアイテムをオーバーライドするスクリプト
/**
* @fileoverview ページ上半分のマスターページアイテムをオーバーライドするスクリプト
* @author Yusuke SAEGUSA
* @version 0.0.1
*/
var myDoc = app.activeDocument;
var pag = myDoc.pages;
for (var i = 0, len = pag.length; i < len; i++) {
var halfHeight = (pag[i].bounds[2] - pag[i].bounds[0]) / 2; //ページの半分
var mpItems = pag[i].masterPageItems;
if (mpItems.length === 0) { continue; }
for (var j = 0; j < mpItems.length; j++) {
if (mpItems[j].allowOverrides
&& mpItems[j].geometricBounds[2] < halfHeight) {
mpItems[j].override(pag[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment