Change Master Page Fill Color

I am trying to change my master page’s fill color which lives in a background layer. The only way I’ve come up with doing it so far is overriding all the master page items and then trying to select every fill path with that color and changing it. But I can’t get it to work out right.
Anyone have some ideas?


tell application "Adobe InDesign CC 2015"
	tell active document
		repeat with myActivePage from 1 to (count page)
			override master page items of page myActivePage destination page page myActivePage
		end repeat
	end tell
end tell
--Then find and replace all the black boxes...somehow.

Hi. There are instances where overrides may be necessary, due to placement and object overlap, but I can’t tell if that applies to your case. What did you try besides this? My suspicion is you may just not be targeting the master’s item layer. Try returning properties of a selection on the master, as that may help you solve your problem by obtaining the correct object reference.

I didn’t try much else because in my searching I couldn’t find out how to script for the master. I ended up just overriding the master page items. Honestly, it was just simpler that way anyway. Here’s the code I ended up with:


--override all master page items
tell application "Adobe InDesign CC 2015"
	tell thisdoc
		repeat with myActivePage from 1 to (count page)
			override master page items of page myActivePage destination page page myActivePage
		end repeat
	end tell
end tell

--Change black BG to white
tell application "Adobe InDesign CC 2015"
	tell thisdoc
		set x to (every rectangle whose (name of fill color is "Custom Black"))
		repeat with i in x
			set fill color of i to "Paper"
		end repeat
	end tell
end tell