Title: Re: How I Lost 30 pounds...
On 3/6/05 05:26, "Phillip Zannini " <[EMAIL PROTECTED]> wrote:

> Don’t suppose you’d be interested in sharing that script or how to create
> one like it would you Barry?
>
> Best,
> Phillip
>


Sure, here is one of them (I have several, saving messages from different folders) - the Entourage folder and Archive folder are hard-coded in. You will have to change those to suit your set up.

If this proves popular, I will neaten things up and publish to Macscripter.



property archiveFolder : alias "Denise:Users:barryw:Documents:Work:TRB:Customers:Bombardier LUL Doors:eMails:"
set logFilePath to ((path to library folder from user domain) as text) & "Logs:com.barryw.bombardierBackup.log"
-- set up logging
try
    set logFile to open for access logFilePath with write permission
    set eof logFile to 0
on error errmess
    display dialog "an error ocurred opening the log file:" & return & errmess buttons {"OK"} default button 1 with icon stop
    close access logFilePath
    beep
    return
end try
tell application "Console" to open logFilePath as alias
set t1 to current date
-- write log header
write "+++++++++++++++++++++++++" & return to logFile
write "Backup Run started: " & t1 & return to logFile
write "+++++++++++++++++++++++++" & return to logFile
-- start processing messages
tell application "Microsoft Entourage"
    set theFolder to folder "Bombardier (VLU)" of folder "Customers" of folder "Work"
    set theMessages to messages of theFolder
    set filesWritten to 0
    set writeErrors to 0
    repeat with aMessage in theMessages
        --set aMessage to first message of theFolder
        set sentTime to time sent of aMessage
        set fileName to subject of aMessage & " [" & short date string of sentTime & " " & time string of sentTime & "]"
        -- take out the characters that play havoc with the backup
        repeat with aPair in {{":", ";"}, {"/", "-"}, {"\"", "''"}, {">", "]"}, {"<", "["}, {"?", "*"}}
            set AppleScript's text item delimiters to {item 1 of aPair}
            set textItems to text items of fileName
            set AppleScript's text item delimiters to {item 2 of aPair}
            set fileName to textItems as text
        end repeat
        tell me to write fileName & ": " to logFile
        tell application "Finder" to set fileExists to exists file fileName of archiveFolder
        if not fileExists then
            set modDate to time sent of aMessage
            save aMessage in (archiveFolder as text) & fileName
            tell application "Finder" to set modification date of alias ((archiveFolder as text) & fileName) to modDate
            set filesWritten to filesWritten + 1
            tell me to write "***Written***" & return to logFile
        else
            tell me to write "Skipped" & return to logFile
        end if
    end repeat
end tell
set t2 to current date
-- write log footer
write "+++++++++++++++++++++++++" & return to logFile
write "Backup Run ended: " & t2 & return to logFile
write "time taken: " & t2 - t1 & " seconds" & return to logFile
write "Files Written: " & filesWritten & return to logFile
write "+++++++++++++++++++++++++" & return to logFile
close access logFile


--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the All-New Entourage Help Pages? - Check them out:
        <http://www.entourage.mvps.org/>

Reply via email to