• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Working with a text selection in Quark
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Working with a text selection in Quark (From: Rob Stott <email@hidden>)

  • Prev by Date: Re: Tex-Edit, Paste clipboard?
  • Next by Date: Re: Tex-Edit, Paste clipboard?
  • Previous by thread: Re: Working with a text selection in Quark
  • Next by thread: AppleScript broken :(
  • Index(es):
    • Date
    • Thread