Re: Unicode to plain text
Re: Unicode to plain text
- Subject: Re: Unicode to plain text
- From: John Delacour <email@hidden>
- Date: Thu, 19 Sep 2002 10:34:09 +0100
At 3:14 pm -0700 18/9/02, Jon Pugh wrote:
At 12:02 PM -0700 9/18/02, Jon Pugh wrote:
Does anyone know how to convert utxt to TEXT in plain AppleScript?
And the winner is:
At 2:04 PM -0700 9/18/02, John Coelho wrote:
>set plain_text to +class ktxt; of (unicodeString as record)
Thank you.
Thank you indeed! This solves what I too was beginning to think was insoluble.
To get the text of a plain text message in Eudora, one does:
set s to body of message 1
To do the same thing in Mail, here's the very shortest way:
tell app "Mail"
set s to the content of the first item of (get the selection)
end
if class of s is Unicode text then set s to Gclass ktxtH of (s as record)
Dontcha love this new 'English-like' AS everyone is talking about :-)
JD
PS.
Chris N. This clears up the little difficulty with the script I sent
you with the UTF7 stuff. You'll find that this script will now give
you the message without the garbage at the end:
(* Display a UTF-7 encoded Mail message as Unicode in TextEdit *)
set {d, tmp} to {current date, path to temporary items}
set n to d - (get date (("1/1/" & (d's year) + 1)))
set f to "" & tmp & "MAIL" & n & ".txt"
set {Ocode, Ucode, Usig} to {"unicode-2-0-utf-7", "unicode-2-0", "~"}
tell app "Mail"
set s to the content of the first item of (get the selection)
end
if class of s is Unicode text then set s to Gclass ktxtH of (s as record)
set s to TECConvertText s fromCode Ocode toCode Ucode
open for access file f with write permission
write Usig to file f
write s to file f
close access file f
tell app "Finder"
open file f using application file id "com.apple.textedit"
end
tell app "TextEdit" to activate
-- JD
_______________________________________________
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.