Paragraph style groups?

I’m trying to search for text that’s formatted with a paragraph style that is in a paragraph style group, and I can’t figure out how to search for it. AppleScript doesn’t seem to recognize styles within a group.

set find what of find text preferences to myoldyear
set applied paragraph style of find text preferences to "copyright" of paragraph style group "xMASTER"
set change to of change text preferences to mynewyear
set include master pages of find change text options to true
tell mydoc
set mytemp to change text
end tell

This gives me a syntax error: Can’t get “copyright” of paragraph style group “xMASTER”. Access not allowed.

Any help?

You’re passing the name of a paragraph style, rather than a style. Try inserting paragraph style before “copyright”.

Hi. Welcome to MacScripter.

Most of the terms in your script aren’t in vanilla AppleScript but apparently from some application. Shane obviously recognises them, but it would help people generally if you mentioned the application in your subject line and included the relevant ‘tell’ statement in the script.

well… duh of course I should say what app I’m working with. It’s InDesign. Sorry.

		tell application "Adobe InDesign CC 2019"
			activate
			open myfile
			set mydoc to active document
					set find what of find text preferences to myoldyear
					set applied paragraph style of find text preferences to "copyright" of paragraph style group "xMASTER"
					set change to of change text preferences to myyear
					set include master pages of find change text options to true
					tell mydoc
						set mytemp to change text
					end tell
end tell