Changing the color of items within a group

I’ve got this script that does a bunch of prepress tasks and one of the things it does is change the fill and stroke color of graphic frames, text frames and text from registration to black. If a graphic frame or text frame is within a group, it will not change the color. Is it possible to change the color of items within a group WITHOUT having to ungroup the group?

Here’s the color changing part that I have so far:

			
-----------------------------------------------------------------------------------------	
							
							--CHANGING ANYTHING IN REGISTRATION TO BLACK	
							
							--Checking to see if the Registration swatch is used and changing everything that is in Registration to Black
						else if documentSwatch is not in unusedSwatches and registrationSwatch contains name of documentSwatch then
							set documentBoxes to (every text frame)
							set graphicBoxes to every rectangle
							set documentGroups to every group
							
							
							--Changing registration fills and strokes on graphic boxes to black
							repeat with graphicBox in graphicBoxes
								set graphicFillColor to name of fill color of graphicBox
								set graphicStrokeColor to name of stroke color of graphicBox
								if graphicFillColor contains "Registration" then
									set fill color of graphicBox to "Black"
								end if
								if graphicStrokeColor contains "Registration" then
									set stroke color of graphicBox to "Black"
								end if
							end repeat
							
							
							--Changing registration fills and strokes on text frames to black
							repeat with documentBox in documentBoxes
								
								tell documentBox
									set fillColor to name of fill color
									set strokeColor to name of stroke color
									
									if fillColor contains "Registration" then
										set fill color to "Black"
									end if
									if strokeColor contains "Registration" then
										set stroke color to "Black"
									end if
								end tell
								
							end repeat
							
							
							--Changing registration fills and strokes on all graphic frames and text frames that are nested within a group
							repeat with documentGroup in documentGroups
								set nestedGroups to all page items of documentGroup
								repeat with i from 1 to number of nestedGroups
									set nestedGroup to item i of nestedGroups
									tell nestedGroup
										if graphicFillColor contains "Registration" then
											set fill color of graphicBox to "Black"
										end if
										if graphicStrokeColor contains "Registration" then
											set stroke color of graphicBox to "Black"
										end if
										if fillColor contains "Registration" then
											set fill color to "Black"
										end if
										if strokeColor contains "Registration" then
											set stroke color to "Black"
										end if
									end tell
								end repeat
							end repeat
							
						end if
					end repeat
					
					--Changing all registration text to black
					set registrationSwatch to swatch "Registration"
					tell (stories's characters whose fill color's name is "Registration") to if not it is {} then set fill color to "Black"
					tell (stories's characters whose stroke color's name is "Registration") to if not it is {} then set stroke color to "Black"
					
					
					-----------------------------------------------------------------------------------------	

if you use the all page items collection, you get all items regardless of whether they are part of a group. So something like:

tell application id "com.adobe.InDesign" 
	tell document 1
		set documentBoxes to every item of all page items whose class is text frame
		set graphicBoxes to every item of all page items whose class is rectangle

Thanks! That works great. :slight_smile: I think I’m finally finished with my pre-press script. I’ll go post it now in case anyone else can use parts of it.