Quark box cannot find box it created

I’ve got a fairly complex script but I’m having trouble with the following distilled point. It drills through all text boxes collecting attributes of each text style range and post the results into a new text box. But it will error out on some but not all. It will error out on finding the newly-created text box so that I can set story 1 to it.

Checking the attributes of the newly created box shows no anomalies with the name and I cannot see a reason why in the analysis.

Attached is the code snippet:


tell application "QuarkXPress"
	tell layout space 1 of project 1
		make new layer at beginning with properties {visible:true, locked:false, color:{36981, 146, 1228}, name:"Callout", keep runaround:true, suppress print:false}
		tell page 1
			tell text box 4 of layer "variable"
				--repeats for each text style range and paragraph gathering properties on each
				--end repeat
				set bigname to "Jim11"
				set name to (bigname as text)
				--set Sbox to (name of it)
			end tell --text box i of layer 1
			tell layer "Callout"
				
				make new text box at end with properties {bounds:{"10.766\"", "-2.818\"", "12.016\"", "-0.041\""}, color:"None", runaround:none runaround, name:"Tbox " & bigname, vertical justification:bottom justified}
				-- this box is made with these attributes
				--	set arnold to object reference of text box 1
				set arnold to object reference of generic box whose name is ("Tbox " & bigname)
				
			end tell --layer 2
			
			--tell text box ("Tbox " & bigname)
			--tell text box "Tbox Jim11"
			tell generic box arnold
				try
					set story 1 to "myTSRList"
				on error
					display dialog (bigname as string)
				end try
			end tell --text box Target box & i
			
		end tell --page 1
	end tell --layout space
end tell --qxp

The new text box obeys what I tell it to. It’s on the correct layer, position and name.

As you can see by the comments, I’ve tried abstracting the reference, specified it directly and even tried using an object reference.

The object reference fails in trying to find the just created box. What other info will help solve my problem? thanx, sam

The main problem with what you were doing is that the text box “Arnold” is compleatly off the page and therefore wont accept the commands from the script. If you change the bounds so that it is on the page then these work. It has been a while since I have played around much with scripting quark so I’m not sure what the current rules for scripting items placed on the pastboard are. If you need the text box off the page then try having the top of the box just on the page and set up first basline rules so that the text itself is off the page.

tell application "QuarkXPress"
	activate
	tell layout space 1 of project 1
		make new layer at beginning with properties {visible:true, locked:false, color:{36981, 146, 1228}, name:"Callout", keep runaround:true, suppress print:false}
		tell page 1
			tell text box 4 of layer "variable"
				--repeats for each text style range and paragraph gathering properties on each
				--end repeat
				set bigname to "Jim11"
				set name to (bigname as text)
				--set Sbox to (name of it)
			end tell --text box i of layer 1
			tell layer "Callout"
				make new text box at end with properties {bounds:{"0\"", "0\"", "0.5\"", "2\""}, color:"None", runaround:none runaround, name:"Tbox " & bigname, vertical justification:bottom justified}
			end tell --layer 2
			tell text box ("Tbox " & bigname)
				try
					set story 1 to "myTSRList"
				on error
					display dialog (bigname as string)
				end try
			end tell --text box Target box & i
			
		end tell --page 1
	end tell --layout space
end tell --qxp

tell application "QuarkXPress"
	activate
	tell layout space 1 of project 1
		make new layer at beginning with properties {visible:true, locked:false, color:{36981, 146, 1228}, name:"Callout", keep runaround:true, suppress print:false}
		tell page 1
			tell text box 4 of layer "variable"
				--repeats for each text style range and paragraph gathering properties on each
				--end repeat
				set bigname to "Jim11"
				set name to (bigname as text)
				--set Sbox to (name of it)
			end tell --text box i of layer 1
			tell layer "Callout"
				set arnold to make new text box at end with properties {bounds:{"10\"", "0\"", "11.5\"", "2\""}, color:"None", runaround:none runaround, name:"Tbox " & bigname, vertical justification:bottom justified}
			end tell 
			tell arnold
				try
					set story 1 to "myTSRList"
				on error
					display dialog (bigname as string)
				end try
			end tell --text box Target box & i
		end tell --page 1
	end tell --layout space
end tell --qxp

Thank you for seeing what I couldn’t see. I’ve been studying this for a few days now, and couldn’ make that connection. thanx, sam
:slight_smile: