Re: Changing case to lower case in QuarkXPress v5
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: Tue, 28 Oct 2003 10:15:12 -0500
Date: Mon, 27 Oct 2003 13:31:36 -0500
Subject: Re: Changing case to lower case in QuarkXPress v5
From: Bob Kalbaugh <email@hidden>
On 10/27/03 10:26 AM, "Arthur Knapp" <email@hidden> wrote:
If I were going to re-write this today, I would probably adopt your
method of working with each style run
I have to confess, I'm glad I haven't done any Quark scripting in a
while.
Despite Shane's helping guidance, trying to master Quark scripting is
not
for the faint of heart.... ;-)
... your method of using TIDs, ... a very fast handler and it was the
first
time I had ever seen it.
Wow, then there's propably a whole bunch of things you've never seen
before.
Does this ring a bell? :
property k0 : ASCII character 0
property k1 : ASCII character 1
property k2 : ASCII character 2
property k4 : ASCII character 4
property k00 : k0 & k0
property k000 : k00 & k0
property k0000 : k000 & k0
property k0001 : k000 & k1
property k0002 : k000 & k2
property k0004 : k000 & k4
property kUsrfLong : ({{p:0}} as string)'s text 1 thru -5
property kUsrfShor : ({{p:0}} as string)'s text 1 thru -3
property kUsrfByte : ({{p:0}} as string)'s text 1 thru -2
on LongToInt(c4)
return ((kUsrfLong & c4) as record)'s p
end LongToInt
on ShorToInt(c2)
return ((kUsrfShor & c2) as record)'s p
end ShorToInt
on ByteToInt(c)
return ((kUsrfByte & c) as record)'s p
end ByteToInt
on IntToLong(i)
return ({{p:i}} as string)'s text -4 thru -1
end IntToLong
on IntToShor(i)
return ({{p:i}} as string)'s text -2 thru -1
end IntToShor
on IntToByte(i)
return ({{p:i}} as string)'s item -1
end IntToByte
is the problem with styled text. I haven't found a way to get it all
at once,
retain style, and replace all at once.... I will presume that there is
no way
other than character by character, or range by range, or word by word,
etc.
I actually think that Jay provided a very nice solution:
Date: Sun, 26 Oct 2003 23:10:11 -0600
From: Jay <email@hidden>
tell application "QuarkXPress"
tell document 1's current box
repeat with x from 65 to 90
if story 1 contains (ASCII character x) then set (every
character where
it is (ASCII character x)) to (ASCII character (x + 32))
which we can improve by working directly with the selection and by
replacing
the osax commands:
property ksUpper : "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
property ksLower : "abcdefghijklmnopqrstuvwxyz"
tell application "QuarkXPress"
tell selection
repeat with i from 1 to 26
try
set every character where (it is (get ksUpper's
character i)) to (get ksLower's character i)
I can't actually test this at the moment, but from what I remember of
my
Quark scripting, the "get" statements are needed inside the
"where/whose"
statement, and we can use the "try" statement rather than passing an
AppleEvent asking Quark to test for the presence of "character i" before
doing something wit it. (I suppose we could also use an "ignoring app
responses" statement rather than the try-statement.)
This *should* be a very fast solution, but I don't have a Quark handy
at
the moment for testing.
...I wanted to say that your script is really nice as it is. It's not
very
slow, really, and it's kinda neat watching the the characters be
replaced.
The "Quarkers" at my work tell me this all the time. It is quite
possibly
my most successful and beloved work-related script ever. :)
{ 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.