Quark 6.5, find and replace with user input

Hi All -

I have a group of several hundred files that I need to open up, find/change the date, then save and close. I have everything I need, but I’m stuck on the find/change part. I can hard code what I need to change, with this:

set old_word to “xxxx”

and the script works fine when I do that. The problem is, I don’t want to have to hard code the dates in, so I have a dialog box that gets the input from the user:

display dialog “What is the old date?” default answer “” buttons {“OK”} default button 1

When I use dialog boxes to get the old and new dates, this is the resulting error:

QuarkXPress got an error: Can’t set contents of every text of every story of document 1 whose it = {} to “January 1, 2006”.

Here is the completed script as I have it now. I’ve tried a bunch of different ways to pull this off, it’s just really weird. Anyone have some insight as to what I’m doing wrong?

display dialog “What is the old date?” default answer “” buttons {“OK”} default button 1
set old_word to text of result
display dialog “What is the new date?” default answer “” buttons {“OK”} default button 1
set new_word to text of the result
tell application “QuarkXPress”
tell document 1
set contents of text of every story where it = old_word to new_word
end tell
end tell

Oh, and I know the syntax is wrong for the “set old_word to result.” i was in a hurry to post.