Re: help
Re: help
- Subject: Re: help
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 20 Mar 2001 10:14:41 -0800
On 3/19/01 10:08 AM, "bill bi" <email@hidden> wrote:
>
I am writing a script to transfer email to filermaker pro, but I do not know
>
the name of "From" and "sent" in the in box of ms outlook folder, Is any
>
body know???
>
>
I can get the "Subject", and "Content", it is as follows:
>
>
>
tell application "Outlook Express"
>
set theMessages to every message of the in box folder
>
repeat with theMsg in theMessages
>
set theSubjectList to theSubjectList & subject of theMsg
>
set theContentList to theContentList & content of theMsg
>
set foundSomeText to true
>
end repeat
>
end tell
>
>
from above code, you will see "Subject" is subject, "Content" in content,
>
but how about "From" and "sent"(time).
The way to find out is to look at the Outlook Express dictionary entry for
'message'. The "From" is a little tricky, perhaps. You will see that one of
the properties of 'message' is 'sender', and that it is of class 'address';
sender - address -- sender of the message
If you then look up class 'address', you discover
Class address : An e-mail message address
Plural form:
addresses
Properties:
display name Unicode text -- the name used for display
address string -- the e-mail address
(In OE, you can treat any entry of class 'Unicode text' just as ordinary
text - there is an automatic conversion.)
That means that if you do
set theSender to sender of theMsg
the result will be a record like this:
{address:"email@hidden", display name:"Joe Blow"}
Sometimes, display names are empty: ""
What you probably want to do here is:
set theSender to sender of theMsg
set theDisplayName to display name of theSender
set theAddress to address of theSender
set theFrom to "<" & theAddress & ">"
if theDisplayName /= "" then
set theFrom to theDisplayName & " " & theFrom
end if
Instead of concatenating lists as you've been doing:
set theFromList to theFromList & theFrom
you would be much better (to avoid memory problems) to do this instead:
set end of theFromList to theFrom
and do the same thing with all your lists.
-------------------------
To get the "Sent", you'll notice that that there is another property of
'message' called
time sent --date -- time at which the message was sent
This is of class 'date', not string (text).
set theTimeSent to time sent of theMessage
That will give you something in this format:
-- date "Tuesday, March 20, 2001 10:08:33 AM"
depending on the language and Date & Time Control panel settings of your
computer.
So you may want to convert it to a string:
set textSent to date string of theTimeSent & " " & time string of
theTimeSent -- one line
That will give you something in this format:
"Tuesday, March 20, 2001 10:08:33 AM"
If you then want to change it into "3/20/01 10:08 AM", you're going to need
a time conversion routine or an osax. If you're doing this just for
yourself, either will do. If you're doing this for others who may have very
different time and date settings from yours, involving different languages,
day/month/year order, 12 or 24 hr. clock, etc.. conversion handlers can get
extremely tricky. An osax would be better, but then you'd have to require
everyone to use the osax. So maybe you'd better think about what format you
need here, then come back. That part does not relate specifically to OE.
HTH.
--
Paul Berkowitz
References: | |
| >help (From: bill bi <email@hidden>) |