I’m trying to write a script that will look thru a QuarkXpress 6.5 document for a symbol like “¥” and if it finds this symbol it deletes it but colors the text box which the symbol was in to a color like Yellow at 100%.
This is what I have so far and it runs without errors but it won’t delete the symbol “¥” or color the text box to yellow.
Any ideas?
set codeChar to "¥"
tell application "QuarkXPress"
activate
if exists default document 1 then
copy {measurements showing, colors showing} to mpVis
set {measurements showing, colors showing} to {false, false}
do script {codeBoxesYellow}
set {measurements showing, colors showing} to mpVis
beep
activate
display dialog "Done!" buttons "OK" default button 1 giving up after 30
else
display dialog "No Document Open. Do you want to change the "code" character?" buttons {"Cancel", "Yes"} default button "Cancel"
display dialog ¬
"Current Code Character is displayed. To change it, enter a new one and OK this dialog." default answer ¬
codeChar buttons ¬
{"Cancel", "OK, Use this char."} default button ¬
"Cancel"
if text returned of result is not "" then set codeChar to text returned of result
end if
end tell
script codeBoxesYellow
tell application "QuarkXPress"
tell default document 1
set tool mode to drag mode
repeat with i from 1 to count of text boxes
try
tell story 1 of text box i
set x to it --story 1 of text box i
if paragraph 1 of x contains codeChar then
set (every character where it is codeChar) to ""
tell default document 1 to set color of text box i to "Yellow"
tell default document 1 to set shade of text box i to "100%"
end if
end tell
end try
end repeat
end tell
end tell
end script