Find and Replace in QuarkXpress 6.5

Hi,

I am having the task to search for as specified text in Quark document that is having the paragraph style “BODY_TEXT” and also having character style “BOLD” applied on it. This text should be replaced with other text.

For example, there is a paragraph with the text “Project 3A”. This paragraph have the paragraph style “BODY_TEXT” and the text “Project 3A” will have the character style applied to it. I want to replace this text to “Project 5A”. I wrote the script for this. But is not working.

My script is:

tell application "QuarkXPress"
	tell document 1
		repeat with h from 1 to 1 --count of pages
			show page h
			repeat with i from 1 to count of text box of page h
				repeat with j from 1 to count of paragraphs of text box i of page h
					if name of style sheet of paragraph j of text box i of page h is equal to "BODY_TEXT" then
						try
							set (every text of paragraph j of text box i of page h where it is "Project 3A" and character style is "BOLD") to "Project 5A"
						end try
					end if
				end repeat
			end repeat
		end repeat
	end tell
end tell

Can any one guide me what is wrong with the script.

Thanks,
Gopal

maybe you’re over-designating the text you want to change?

You say
if name of style sheet of paragraph j of text box i of page h is equal to “Plain text” then

but then you specify paragraph j again
set (every text of paragraph j of text box i of page h where it is “Project 3A” and character style is “BOLD”) to “Project 5A”

Don’t know if that’s overdoing it.

Not sure.