Re: Working with a text selection in Quark
Re: Working with a text selection in Quark
- Subject: Re: Working with a text selection in Quark
- From: wemedge <email@hidden>
- Date: Wed, 10 Oct 2001 19:07:22 -0400
Rob,
I also have no answer to why your script doesn't work, but can offer a
different approach that should be many times faster as it doesn't go
character by character. Try this:
set bigW to "W"
set littleW to "w"
tell application "QuarkXPress 4.11"
set theText to contents of the selection
set AppleScript's text item delimiters to bigW
set theList to text items of theText
set AppleScript's text item delimiters to ""
set finalText to ""
repeat with i from 1 to count theList
if i < (count theList) then
set finalText to finalText & item i of theList & littleW
else
set finalText to finalText & item i of theList
end if
end repeat
set the contents of selection to finalText
end tell
Hope this helps.
Bill
>
I'm trying to write an applescript which will substitute every occurance
>
of a capital letter W with a lower case w in a given selection - I'd have
>
thought it would be pretty easy but I'm running into problems. The script so
>
far is;
>
>
tell application "QuarkXPress"
>
set theTotalCharacters to the count of the characters of the selection
>
repeat with i from 1 to theTotalCharacters
>
if character i of the selection is "W" then set character i of the
>
selection to "w"
>
end repeat
>
end tell