Paul,
Thank you for this explanation. It helps me to understand clearly.
Best,
Jim
On 3/23/05 8:42 AM, "Paul Berkowitz" wrote:
You can coerce to text all you want - no error will result - but it will not
be _plain text_. It will be 'international' styled text if the original (as
in your case) was Unicode, styled text, etc. In AppleScript, 'text' and
'string' do not mean what most people think they mean - they do not mean
'plain text' - they cover most types of text except true Unicode. Styled
text can be represented by, and can be coerced to, a record, where one of
the record properties is indeed plain text, known confusingly as 'text'.
That's what the handler does. This handler is Arthur Knapp's. It's his final
version and gets around all sorts of peculiar hang-ups that simpler versions
hit (such as when the text is plain text to begin with, or certain true real
Unicode characters that do not coerce to styled text at all).
An earlier version of the handler makes the process a little clearer, but
does hit a few of those hang-ups, so don't use it:
on AsText(str)
--corece Unicode or other text to styled string to plain text
try
--return (((str as string) as record)'s «class ktxt»)
return (text of ((str as string) as record)) as string
end try
return str as string -- if plain text to begin with, or real Unicode
end AsText
> Many thanks Paul! Yes, that did the trick.
> Question: Do I infer from your use of the handler that one can't directly
> coerce to text, e.g.,
>
> set txtByline to content of text field "txtByline" as text
--
email@hidden
__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden
This email sent to email@hidden