Re: Read RTF in OS X?
Re: Read RTF in OS X?
- Subject: Re: Read RTF in OS X?
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 22 Apr 2002 07:28:54 -0700
On 4/22/02 4:52 AM, "Mr Tea" <email@hidden> wrote:
>
Using TextEdit to work with the file means that you don't have to worry
>
about which type of rtf it is.
>
>
I've been doing something like this:
>
>
set theRTF to [a suitable item]
>
tell application "TextEdit"
>
open theRTF
>
set theText to every paragraph of text of document 1 as text
>
end tell
>
>
One thing that I've found when doing this is that if I send the contents of
>
the variable to the clipboard for pasting into a document elsewhere, the
>
pasted text contains the 'wrong kind' of return characters.
That's right. It can read any of the varieties (ASCII character 10, ASCII
character 13, ASCII character 13 & character ASCII 10) i.e. CR, LF, CR & LF,
all as returns with no funny boxes, but it writes just LFs. If you save a
TextEdit file 'as plain text' (.txt), then open it up in Tex-Edit Plus or
SimpleText, you get run-on text with funny boxes and no carriage returns. So
much for 'Mac-version' line-endings.
Odder (OT) is what happened to me yesterday. I had SimpleText open in
Classic for converting some fonts. (The new Apple standard font in OS X,
Lucida Grande, doesn't exist in Simple Text. It converts it to the weirdest,
most illegible font it can find: Edwardian Script ITC, a florid cursive
copperplate. Completely unreadable when you open it in OS 9. If you try
pasting Lucida Grande from TextEdit into TexEdit-Plus X, which works, then
converting there to, say, Verdana, and saving as a SimpleText file, you
can't unless you want to lose all bold and italic, since they're now
separate fonts. If you want to save a ReadMe as .txt for OS 9 purposes in
TextEdit itself, you can't unless you want to lose all bold, italics and
colors. So SimpleText in Classic it is. I don't have BBEdit.)
Anyway, with SimpleText open, double-clicking text files opened in ST
instead of TextEdit. Not only that, but .RTF files also tried to open in
SimpleText when double-clicked! But couldn't, of course, just errored.
Checking with ShowInfo/Open with Application showed that TextEdit was indeed
set as the application to open all .rtf and .txt files, but SimpleText
insisted on doing it, or trying to. No solution except to use TextEdit's
File menu or drag the .rtf file onto TextEdit's icon in the dock. Very
weird.
--
Paul Berkowitz
_______________________________________________
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.