• 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: Changing case to lower case in QuarkXPress v5
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing case to lower case in QuarkXPress v5


  • Subject: Re: Changing case to lower case in QuarkXPress v5
  • From: Arthur Knapp <email@hidden>
  • Date: Mon, 27 Oct 2003 10:26:15 -0500

Date: Sun, 26 Oct 2003 21:54:49 -0500
Subject: Changing case to lower case in QuarkXPress v5
From: "Bob.Kalbaugh" <email@hidden>

I've been working on a script for QuarkXPress v5 that gets the contents of
selected text from a document, runs it through a handler to change the case
and then changes the selection to the revised text. It worked fine but, if
any of the text in the selection was styled it got lost in translation.
(contents of selection returns plain text.)

I have an old script that does the same thing.

However, it is slow and clunky.

Mine too, but see below:

on lowCase(x)
...
set nTxt to nTxt & (character (offset of i in uChars) of lChars)

One of you biggest slow downs here is the "offset of" command. When used
for each character of a long string, it can really slow things down.

Here is my solution, circa the year 2000 or so:

tell application "QuarkXPress" to activate

set kUpper to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set kLower to "abcdefghijklmnopqrstuvwxyz"

tell application "QuarkXPress" to set theText to contents of selection

repeat with x from 1 to 26
if theText contains kUpper's item x then
set text item delimiters to kUpper's item x
set theText to theText's text items
set text item delimiters to kLower's item x
set theText to "" & theText
end if
end repeat

-- Have to keep style, character by character
--
tell application "QuarkXPress"
repeat with x from length of theText to 1 by -1
if character x of theText is not return then
ignoring application responses
set character x of selection to character x of theText
end ignoring
end if
end repeat
end tell

If I were going to re-write this today, I would probably adopt your
method of working with each style run, but under no circumstances
would I use "offset of" for each character, I know from experience
that text item delimiter soulutions will almost always be faster,
(though I can't speak for Panther, as I have't given it a shot yet). :)

{ Arthur J. Knapp;
<mailto:email@hidden>;

What...? Oh...!
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Changing case to lower case in QuarkXPress v5
      • From: Bob Kalbaugh <email@hidden>
  • Prev by Date: Re: newbie question: real with fraction to int
  • Next by Date: Embedded keywords
  • Previous by thread: RE: Changing case to lower case in QuarkXPress v5
  • Next by thread: Re: Changing case to lower case in QuarkXPress v5
  • Index(es):
    • Date
    • Thread