InDesign CS Override Master items script??

I’m looking for a script for InDesign CS that will override all of the master items on all of the pages of a document. Can anyone help me out with this?? We had one that worked beautifully in ID2, but it won’t work in CS. Here are a couple that used to work:
tell application “InDesign 2.0.2”
master page items of every page of active document
end tell

–or

tell application “InDesign 2.0.2”
tell active document
tell pages
tell master page items
try
unlink from master spread
end try
end tell
end tell
end tell
end tell

I recently upgraded to OS 10.3.6, and when I open one of these scripts in the Script Editor, the script is changed drastically. I am not a scripter, so haven’t yet been able to figure this out! I did find a script that will override the first item on a page, but I guess I just don’t know enough to modify it. When I’ve tried, I get a message like “can’t get all items of master page”.

this one unlocks one item on the first page:
tell application “InDesign CS”
tell document 1
override item 1 of master page items of page 1 destination page page 1
end tell
end tell

Ah yes, Adobe changed InDesign’s handling of master page items in CS, and CS now requires you to be more specific about what you’re doing. This new script seems to work for my uses:

tell application “InDesign CS”
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

Also, CS now allows you to unlock all master page items without the need for a script, I believe. Select all your pages in the Pages palette and choose “Override All Master Page Items” from the palette menu.

I don’t know why your scripts are being garbled, though. Good luck!