Title: Re: Find number of Emails in Ent 2004
On 25/11/04 1:15 am, "Geoff WALLACE" <[EMAIL PROTECTED]> wrote:

> Hello All,
>
> In Ent X when doing an Advanced Find ,it showed a progress bar and count of
> the items it was searching, in Ent 2004 it doesn't show this.
>
> Whats a quick way of finding out how many emails you have in all folders?
>
> -------
> Regards
> Geoff WALLACE

With a script like this. For me it gives this answer:

Identity: ID 2
Folders: 201
Messages: 102,760
Data Folder Size: 2060mb

Save the script as a compiled script & put it in the ‘Entourage Script Menu Items’ folder in your ‘Microsoft User Data’ folder. The script can be manually run from the menu.




-- this is the line that kicks it all off and starts the recursion
-- see how it works in the 'countTheMail' routine later
set theCounts to countTheMail(application "Microsoft Entourage")

-- Now, find out where the data is

tell application "Microsoft Entourage"
    set theName to name of current identity
    set theDataFolder to ((path to MUD as text) & "Office 2004 Identities:" & theName)
end tell
-- and get it's size from the finder
tell application "Finder" to set diskUse to physical size of item theDataFolder
--convert bytes to megabytes
set theSize to (diskUse / 1048576 + 0.5) div 1

-- We got the info from the routines below, now we display it
-- and record the button pressed in the dialog box
set buttonPushed to display dialog "Identity \"" & theName & "\"" & return & ¬
    "You have " & commafy(item 2 of theCounts) of me & " mailfolders containing " & commafy(item 1 of theCounts) of me & " messages" & return & ¬
    "The mail occupies " & theSize & "mb of disk space." buttons {"Copy…", "O.K."} ¬
    default button 2
if the button returned of buttonPushed is not "O.K." then
    set the clipboard to "Identity: " & theName & return & ¬
        "Folders: " & commafy(item 2 of theCounts) of me & return ¬
        & "Messages: " & commafy(item 1 of theCounts) of me & return ¬
        & "Data Folder Size: " & theSize & "mb" & return
end if


on countTheMail(theMailFolder)
    -- this is the main recursive loop. Remember that all variables
    -- used here are LOCAL and are reset each time the routine is entered
    -- this routine is entered once for each mail folder found
    tell application "Microsoft Entourage"
        set theFolders to every folder of theMailFolder
        set mailcount to 0
        -- count the folders at this level
        set folderCount to count theFolders
        repeat with aFolder in theFolders
            -- and for every folder, count the messages
            set mailcount to mailcount + (count every message of aFolder)
            -- do we need to go down another level?
            if every folder of aFolder is not {} then
                -- yes we do, so...
                -- ...recursively call this routine, using this folder as the start point :)
                set temp to my countTheMail(aFolder)
                -- and update folder & message counts
                set mailcount to mailcount + (item 1 of temp)
                set folderCount to folderCount + (item 2 of temp)
            end if
            -- next folder at current level
        end repeat
    end tell
    -- now, send the answer back up the line
    return {mailcount, folderCount}
end countTheMail

on commafy(theNum)
    -- Another recursive routine that converts an integer to a western formatted
    -- number with commas between the 'thousand' groupings
    if theNum > 999 then return (commafy(theNum div 1000) & "," & text -3 thru -1 of ("00" & ((theNum mod 1000) as text)))
    return theNum as text
end commafy


--
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