Title: Re: Total size of all messages in a folder.
Beautiful. Thanks.

From: Allen Watson <[EMAIL PROTECTED]>
Reply-To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Date: Sun, 17 Jun 2001 13:22:02 -0700
To: "Entourage:mac Talk" <[EMAIL PROTECTED]>
Subject: Re: Total size of all messages in a folder.


On or near 6/17/01 12:20 PM, contains_phenylalanine at [EMAIL PROTECTED] observed:

> Looking for a script to run that tells me the total size of all messages in
> a folder.  I would like to know when I am approaching 5Mb or 2Mb, etc...
>
> Can anyone help?
>
I had that in OE, but have not used it since moving to E. Let me check...it may work.

A little adaptation and improvement....

(* Show Message Sizes -- For Microsoft Entourage
Sun, Jun 17, 2001, <[EMAIL PROTECTED]>
Calculates size of individual messages in K, also shows total of all selected messages within the selected folder.
*)
property TotalOnly : true
global totSize
set totSize to 0
display dialog "Calculates total size of all selected messages. Show individual message sizes, total only, or quit now." buttons {"Total Only", "Message Sizes", "Quit"} default button 1
if button returned of result is "Total Only" then
    set TotalOnly to true
else if button returned of result is "Quit" then
    return
else
    set TotalOnly to false
end if

tell application "Microsoft Entourage" --
    set currentMessages to the current messages --
    if (count of currentMessages) is 0 then
        display dialog "No messages were selected."
        return
    end if
    set theList to {}
    set theFolder to storage of (item 1 of currentMessages)
    repeat with theMsg in the currentMessages --
        set {theSub, theSize} to my ProcessMsg(theMsg) --
        if not TotalOnly then copy {theSub & " = " & theSize} to end of theList --
    end repeat --
    set totK to ((totSize div 1024) as text) & "." & ¬
        text 1 thru 1 of ((totSize mod 1024) as text) & " K"
    copy {"Total size in folder " & name of theFolder & " = " & totK} to end of theList
    set savDel to AppleScript's text item delimiters --
    set AppleScript's text item delimiters to return --
    if TotalOnly then
        display dialog theList as text --
    else
        set theReport to make new incoming message at folder "Inbox" with properties {subject:"Size of folder " & name of theFolder, content:theList as text}
        open theReport
    end if
    set AppleScript's text item delimiters to savDel --
end tell --

on ProcessMsg(theMsg) --
    tell application "Microsoft Entourage"
        set l to data size of theMsg
        set totSize to totSize + l
        set inK to ((l div 1024) as text) & "." & ¬
            text 1 thru 1 of ((l mod 1024) as text) & " K"
        return {subject of theMsg, inK} --
    end tell
end ProcessMsg
--
Add me to Palm/Visor: http://signature.coola.com/?[EMAIL PROTECTED]
Allen Watson <[EMAIL PROTECTED]> XNS name: =Allen Watson
A Mac family since 1984 <http://home.earthlink.net/~allenwatson/>
Applescripts for Outlook Express and Entourage: <http://homepage.mac.com/allenwatson/>


Reply via email to