Quark text search/ replace query...

Hi there,

Please can someone clarify this for me. I’ve been doing some automation with Quark 6.52 that involves the search/ replacing of text.
On the whole eveything has worked fine until I started another project the other day.

This project involves several text replacements on the same page of what will be a multi-page document. Everything started ok however now I’ve hit a slight snag in that I’m now getting the following error:-

QuarkXpress got an error: Can’t set contents of every line of document whose it = “xxx” to “yyy”

I’ve had a read through my Shirley Hopkins book to try and ascertain whether or not I need to search a ˜line’, ˜paragraph’ or ˜story’ but having tried a few variations this hasn’t helped.

The trimmed down search looks like this:-

tell application "QuarkXPress" 
   activate 
   tell front document 
      set (contents of text of every story where it = "test") to "replaced" 
   end tell 
end tell

Please can someone point me in the right direction.

Thanks in advance,

Nick

I use this for pretty much all occasions of changing text

tell application "QuarkXPress"
	tell document 1
		set doRepeat to true
		repeat while doRepeat is true
			try
				set (every text of every story where it is "Test") to "replaced"
			on error
				set doRepeat to false
			end try
		end repeat
	end tell
end tell

Hi Mark,
Thanks for your reply and for putting together the code, which works great. I’ll have to do some further testing with it but so far it’s looking good.

Thanks again for taking the time to have a look at it Mark.

Regards,

Nick