Re: Text without formatting (OS 9.1)
Re: Text without formatting (OS 9.1)
- Subject: Re: Text without formatting (OS 9.1)
- From: Nigel Garvey <email@hidden>
- Date: Thu, 1 Mar 2001 12:28:09 +0000
"John McElwain" wrote on Wed, 28 Feb 2001 15:21:16 -0700:
>
I need to capture an error message in an AppleScript and place it into a
>
FileMaker field without formating. I had previously coersed the
>
data like this...
>
>
set cell "Error Message" to (errorMes as Unicode text) as text.
>
>
When compiled under OS 9.1, this approach no longer works. Can
>
anybody suggest a good alternative. Thanks for your help.
There's Richard 23's brilliant method:
set plainText to <<class ktxt>> of (formattedText as record)
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.
Another method is to use the clipboard:
activate
set the clipboard to formattedText
set plainText to the clipboard as string -- not 'as text'
This isn't noticeably slower for your purposes, but it does require the
application doing the setting to be the frontmost and (of course) it also
uses the clipboard - which may be awkward if you've got something else
there you need to keep.
NG