Re: Text without formatting (OS 9.1)
Re: Text without formatting (OS 9.1)
- Subject: Re: Text without formatting (OS 9.1)
- From: Richard 23 <email@hidden>
- Date: Fri, 2 Mar 2001 01:47:48 -0800
CAUTION: this post begins to delve into gibberish propellor-speak!
>
There's Richard 23's brilliant method:
>
>
set plainText to <<class ktxt>> of (formattedText as record)
>
Thanks I'll take it as a compliment.
>
This is very fast, but it's not something you're officially able to do so
>
it might break at a later date. (But then, things that you *are*
>
officially able to do have been known to change, so don't let that deter
>
you.) It'll also error if formattedText turns out not to be formatted
>
after all.
Actually the first reference I could find to 'ctxt' was in an Apple
Event Registry document dated Winter 1992. It's been around for awhile!
'ktxt' is referred to by the Registry as keyAEText, as opposed to cText
for 'ctxt' if that helps. =:)
Copy some styled text to the clipboard and run the following:
set theData to the clipboard
{the clipboard as record, theData as record}
--> {{string: "hello", styled Clipboard text: <<data styl0015...>>},
{<<class ktxt>>: "hello", <<class ksty>>: <<data styl0015...>>}}
I'm not sure why they're different, but string is "TEXT" and text is
"ctxt".
So I have always gone with the 4 character code method.
Although the little known "best type" property seems to agree with you
about "string" aka "TEXT".
set theData to the clipboard
set theText to <<class ktxt>> of (result as record)
return result's <<class pbst>> -- looks like Pabst...
--> string
As string and text are synonymous it shouldn't make any difference...
I just don't take any chances with it.
Since I'm already going afield I may as well get this off my chest:
{class, <<class pbst>>} of {1,2,3}
--> {list, vector}
first file of application "Finder"
result's {class, <<class pbst>>}
--> {clipping, reference}
R23