Quark and Paragraph Indexing

Hi…This is probably very easy for someone. I am using QXP 4.11 and writing classic scripts. With this one I am having trouble getting the script to change the style of the paragraph AFTER the paragraph that I have an object reference for. I have tried (thisPara +1), paragraph after, next paragraph. Nothing seems to work, and I can’t find much info in Shirley Hopkins book about how quark refers to its paragraphs. Here is the script.

tell application "QuarkXPress™ 4.11"
	activate
	try
		tell document 1
			set theGraphs to (the object reference of ¬
				every paragraph of story 1 of current box whose ¬
				name of style sheet is "INFO")
			
			if the class of theGraphs is not list then
				copy (coerce theGraphs to list) to theGraphs
			end if
			
			repeat with i from (number of theGraphs) to 1 by -1
				set thisPara to (the object reference of paragraph 1 of (item i of theGraphs))
					--How do I reference the paragraph after thisPara to change its style?
			end repeat
		end tell
		set theGraphs to {}
	end try
end tell

So it collects all the references to the INFO spec, puts them in a list for me and I can get it to set an insertion point at the beginning of each occurrence of INFO spec (not shown)…but I can’t seem to get it to access the next paragraph–which is the one that needs to be changed.

Any help greatly appreciated. Thanks in advance. BTW, I first wrote this the old way going para by para testing each and then changing the style of (para i+1)–it worked but it was way slow because there are 20,000 paras in this document and the object reference way is much faster. Thx.

I thought it was easy for someone…guess not.
:?

Hey Bjorn,

Not too desperate, ok? :wink:
This one works for Quark 6.5, but give it a try in Quark 4.
I am refering to the index of the paragraps, which I think is faster and more secure. I have had more or less the same problem, which you can read more of here.

When you have the index of paragraph you can find the next paragraph by counting +1, or you can find first and last characters of this paragraph.

Good luck.
kjeld

tell application "QuarkXPress Passport"
	activate
	set Style_1 to "INFO"
	set style_2 to "Style"
	try
		tell document 1
			tell story 1 of current box
				set vlist to index of (every paragraph whose name of style sheet is Style_1)
				repeat with x from 1 to count of items in vlist
					set nextpara to ((item x of vlist) + 1)
					set firstChar to character 1 of paragraph nextpara
					set lastChar to character -2 of paragraph nextpara -- Character -1 is the return
					set style sheet of paragraph nextpara to style_2
				end repeat
			end tell
		end tell
	end try
end tell