Can't get master page items

I have the following bit of code in my script …

set applied master of activePage to master spread "B-Chapter Starts" -- Apply master
		override text frame 1 of master spread "B-Chapter Starts" destination page activePage -- Unlock text frame
		set unlockFrame to text frame 1 of activePage
		setChapterHeadings(unlockFrame, chapHeadText, chapSubText) of me

It works fine within a nested “tell application …”, “tell active document” loop, but later in the script, near the end of “tell active document” loop, it refuses to work, with the “override text frame” portion giving various errors about not finding the text frame.

I’ve previously labelled the text frame on the master pages to chapterStartLeft (there are two pages to the master spread, both with labelled frames “ the other being chapterStartRight), so I thought I’d try to get around this by using the frame’s label instead of a numeric reference, thus:

set applied master of indexPage to master spread "B-Chapter Starts" -- Apply master
		-- tell indexPage
		
		override text frame "chapterStartLeft" of master spread "B-Chapter Starts" destination page indexPage -- Unlock text frame

… but it just keeps saying “Adobe InDesign CS5.5 got an error: Can’t get text frame “chapterStartLeft” of master spread “B-Chapter Starts” of document id 1163.”

The master applies correctly, the text frame is visible on the document page, and if I manually override it and check the frame’s label, it says chapterStartLeft “ but it just won’t override in my script. I’ve tried using “chapterStartRight”, in case the wrong page was being applied, but still no joy.

Any ideas as to what I’m doing wrong?

Can you post the loop section so that we can give it a go?

As of CS5, you can’t use labels like that – your snippet is looking for a frame whose name (as set in the Layers panel) is “chapterStartLeft”. Try something like:

override text frame 1 of ... whose label is  "chapterStartLeft"

Sorry for delay … been a trifle busy!

Shane, thanks; that did it. How/where did you find out that the method was depreciated? My scripting guide (from Adobe) only goes to CS5.

I can’t remember. I think it was announced somewhere when CS5 was released.