Title: Re: Re setting from header field
on 12/6/01 2:13 PM, Paul Berkowitz at [EMAIL PROTECTED] wrote:


>
> Instead of this:
>
>                  
>                   set display name of sender of theMsg to nameLine
>
> you would have this:
>
> set rightBrackLoc to offset of ">" in nameLine
> set dn to text ((offset of "<" in nameLine) + 1) thru (rightBrackLoc -1) of
> nameLine
> set addr to text (rightBrackLoc + 1) thru -1 of nameLine
> set display name of sender of theMsg to dn
> set address of sender of theMsg to addr
>
> Yes? No?
>

Yes, but i hate 'offset' with a vengeance and never use it myself. Too many possibilities of mistakes (another instance of a ">" sign would muck this up.) Also, someone could be sending an email without using a display name. Then you don't usually get the "< >" sign at all. Although, sometimes you do, but there would be no spaces left, because I'd removed them. Also, TIDs are a lot faster (not that it matters here).

I would do (after all the other text parsing);

    set AppleScript's text item delimiters to {"<"}    
    try
        set dName to text item 1 of nameLine
        try
            set dName to text 1 thru –2 of dName
        on error — no name, but < > around email addrtess
            set dName to ""
        end try
        set eAddress to text item 2 of nameLine  -- may error if no email address
        set AppleScript's text item delimiters to {">"}
        set eAddress to text item 1 of eAddress
    on error
        if nameLine contains "@" and nameLine does not contain " "    
            set dName to ""
            set eAddress to nameLine
        else
            set dName to nameLine
            set eAddress to address of sender of theMsg
         end if
    end try
    set AppleScript's text item delimiters to {""}
    set display name of sender of theMsg to dName
    set address of sender of theMsg to eAddress


?

Thanks Paul

I have incorporated the latest version. Congratulations it appears to be working perfectly :-))

I am a happy camper. However my Lotus Notes administrator has now rung to warn me that user agents are not allowed on a Lotus Notes server.

I am ignoring the warning  for the time being.


-- David Leitch  JPMorgan [EMAIL PROTECTED] +612 9220 1609

Reply via email to