Quark 6.5 OS 10.3.9 selecting a group once an item in it is identified

I have a script that will go through a ton of Quark files and delete a group if it finds it (it’s a job tag with document specs). I worked out how to get it to identify a unique text box on all pages it exists. The problem is, I can’t get figure out how to tell it to take that text box and select the group that it is part of. Has anyone scripted anything like this before?

Here is just the Quark part, which assumes you have a document open in Quark already. It looks for a text box that is positioned at the far right on the page and that starts with “Released version” and then names it so it can be referenced after the loop is done. There would only be one per page so it then needds to delete the group off of each page.



tell application "QuarkXPress"
	activate
	tell front document
		set tool mode to contents mode
		set DocWidth to the page width of it as real
		set FoundNum to 0
		repeat with PageCOunt from 1 to (the count of pages)
			tell page PageCOunt
				repeat with Countr from 1 to count of text boxes
					tell text box Countr
						copy (left of bounds of it as real) to XCoord
						if XCoord is greater than (DocWidth - 0.5) then
							if text of story 1 of it starts with "Released Version:" then
								set FoundNum to FoundNum + 1
								set name of it to ("DeleteThisBox" & FoundNum)
							end if
						end if
					end tell
				end repeat
			end tell
		end repeat
		if FoundNum is not equal to 0 then
			repeat with DeletePgNum from 1 to FoundNum
				set tool mode to drag mode
				tell page DeletePgNum
					select text box ("DeleteThisBox" & DeletePgNum)

					(*This is where I need a command to select the greater group that the selected text box is part of so it can be deleted*)

				end tell
			end repeat
		else
			display dialog ("No Job Tag found.") buttons " " giving up after 3
		end if
	end tell
	close front document saving yes
end tell


Model: Mac G5
Operating System: Mac OS X (10.3.9)

Sorry, I keep posting questions and then answering them myself…

This replaces the main repeat in the Quark section.


repeat with DeleteGroupNum from 1 to FoundNum
set tool mode to drag mode
select text box ("DeleteThisBox" & DeleteGroupNum)
if box type of current box is group box type then
delete current box
end if
end repeat