Re: Script to Copy/Paste Entourage Message Bodies
Re: Script to Copy/Paste Entourage Message Bodies
- Subject: Re: Script to Copy/Paste Entourage Message Bodies
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 25 Mar 2003 14:47:43 -0800
On 3/25/03 1:30 PM, "Ramona Rock" <email@hidden> wrote:
>
Yay! That's brilliant, and it works! Thank you! I do have a couple of
>
minor questions if you don't mind, but that's definitely the substance of
>
the thing. Since you said there were problems with option #2, I just went
>
with option #1.
>
>
1. Why does it send it as plain text instead of rich text? This is a very
>
minor thing since I know I can just change it back to rich text after it
>
gets there, but I had to ask.
First of all, 'content' property of message in Entourage is always a string.
[1] A plain text string. So even if you have HTML formatted text in
Entourage it will just transfer as plain text content anyway. You can't get
the formatted text. [2] Since it's plain text, we might as well make a text
file. AppleScript (since the middle ages and then again since AS 1.7 or 1.8,
but not in 1.6) automatically assigns "TEXT" file type to any file you make
with 'open for access'. This actually is plain text (.txt, "TEXT") not RTF.
Since it has this automatically given file type, and doesn't have an
extension, the icon displays the "TEXT" type. Why do you want to make it RTF
when it isn't rich text, may I ask? If you add ".rtf" to fileSpec you make a
nice looking RTF icon for the file, but TextEdit can't open it because it's
not been encoded as RTF. Try it - it won't open, not even double-clicking it
in the Finder. It's text, not RTF. (You could add ".txt" to the "newstuff"
name. Otherwise, if you play around too much with the same file, it will
lose its text icon.)
>
>
2. The TextEdit document gets opened, accessed and receives the data as
>
expected. But if I make any changes to the document after that (I was just
>
making it rich text and a little bigger like it was originally in Entourage
>
so I could read it better, the text originally gets to the document smaller
>
and in plain text) it changes the name of the document to Untitled? What's
>
up with that?
No, that's because you changed its format to RTF. TextEdit will never save
the back into the same file when you change the format, even if there's no
".txt" extension. it knows the original was not RTF, so it wants you to save
it as a new file, since it will be assigning the .rtf extension when you
close it. Try closing the file - you'll see. It wants you to re-save it with
a new name. To avoid all this, just leave it as TEXT. Assign it the .txt
extension in the script to make TextEdit happy.
[1]. Actually it's Unicode in Entourage itself, but is coerced automatically
to string in Entourage's AppleScript because AppleScript did not have proper
Unicode back when Entourage X came out. You can get the Unicode version by
adding 'as Unicode text' but that won't get you rich text, it just gets you
foreign characters, to cut a long story short. Chances are that in a later
version of Entourage the automatic coercion to string will not occur.
Therefore I added 'as string' because if you write Unicode to a text file
you need to preface it with some characters to indicate to TextEdit that
this is Unicode or it leaves empty space between every character when it
displays the file. I didn't want to get into all this.
[2] If it's HTML, you could get all the HTML source code by parsing the
message's source property, but you'd need some other application like a web
browser that could handle HTML code to display it.
--
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.