Hello,
I’m trying to work out a script that replaces a phone number with a new one which is keyed into a dialog by the user. The old number will always begin with “1-800”, and that part of the string is what I want to use to get Quark to identify which word to replace. However, I haven’t come up with the proper way to reference it (and my code isn’t very streamlined, either). I based this on an older search and replace script found here; I’d credit whomever came up with it, but I can’t seem to locate it.
Any help is greatly appreciated.
set myNumber to (display dialog "What's the new number?" buttons {"Cancel", "OK"} default button "OK" default answer "What's the number?")
set replaceText to (text returned of myNumber) as text
tell application "QuarkXPress"
tell document 1
try
tell every story of every text box
set findText to (object reference of every word where it starts with "1-800") as list
repeat with thisOccurence in findText
set text of thisOccurence to replaceText
end repeat
end tell
end try
end tell
end tell