Title: Re: Wrong dates on E-mails
If you'd like to reset the date on those messages, compile this script in Script Editor, store in Entourage Script Menu Items folder, select the message(s), and run the script. It will set the message to the earliest "Received" header, which would be the time that his ISP received the message from him.

tell application "Microsoft Entourage"
    activate
    set theMsg to item 1 of (get current messages)
    --Locate the first received header
    set oldDelims to AppleScript's text item delimiters
    set hdrs to the headers of theMsg
    (* For some reason, received headers sometimes break into two lines, so
    I have to paste them together. Continuation lines start with a space. *)
    set hdrs to my searchReplace(hdrs, (return & " "), " ")
    set hdrs to my searchReplace(hdrs, (return & tab), " ")
    set hdrs to every paragraph of hdrs
    repeat with i from 1 to (count hdrs)
        set aHdr to item i of hdrs
        if aHdr starts with "Received:" then
            set receivedHdr to aHdr
        end if
        -- The one we want is the last received header, so keep looping
    end repeat
    --Now isolate the date/time stamp
    set AppleScript's text item delimiters to {";"}
    try
        set x to last text item of receivedHdr
    on error theErr number theNum
        display dialog "Err#:" & theNum & " " & theErr
    end try
    set AppleScript's text item delimiters to oldDelims
    tell me to set dateStamp to date x
    display dialog "Set sent time to " & date string of dateStamp & " " & time string of dateStamp & ¬
        "?" buttons {"No", "Set it"} default button 2
    if button returned of result is "No" then
        return
    else
        set time sent of theMsg to dateStamp
    end if
end tell

-- routine to do a search and replace on text
on searchReplace(mainString, searchString, replaceString) -- Parameters: search, replace, the String
    set olddelis to AppleScript's text item delimiters
    
    set AppleScript's text item delimiters to (searchString)
    set theList to (every text item of mainString)
    
    set AppleScript's text item delimiters to (replaceString)
    set theString to theList as string
    
    set AppleScript's text item delimiters to olddelis
    return theString
end searchReplace



On or near 2/3/02 3:40 PM, Irving Weissman at [EMAIL PROTECTED] observed:

> My in-box in arranged by the date the e-mail is sent. From one individual,
> mail sent in 2002 is coded as being sent in 2001 and 2001 as 2000.
> Therefore, I tend not to see the mail when it arrives. Is the problem with
> Entourage or with his ISP?  Thank you.  Irving Weissman
>

--
Microsoft MVP for Entourage/OE/Word (MVPs are volunteers)
Allen Watson <[EMAIL PROTECTED]> XNS name: =Allen Watson
Applescripts for Outlook Express and Entourage: <http://homepage.mac.com/allenwatson/>

Reply via email to