On 11/14/03 10:14 AM, Paul Berkowitz <[EMAIL PROTECTED]> wrote:

> On 11/14/03 7:38 AM, "Jeffrey Berman" <[EMAIL PROTECTED]> wrote:
> 
>> Is there a way to structure AppleScript syntax so that an action is carried
>> out recursively on messages within all levels of subfolders of an Entourage
>> mail account?  For instance, how could one write syntax to check the latest
>> time received of any message in any of the embedded folders of a particular
>> account?
> 
> Yes, although recursiveness truly tests Applescript's memory access and
> could cause a stack overflow if you get too many levels deep. usually you;d
> get nowhere near that with Entourage folders. You have to write a handler -
> a subroutine - which can call itself, and keep doing so at each level.
> (Usually, once you get it figured out for the next level it works at all
> levels.)

Paul:

Thanks, as always, for your detailed response.  The script I am working on
needs a subroutine that returns true if any message within any folder of the
default mail account is equal to or greater than a certain date.  If not,
the subroutine should return false.

The following solution seems to work (with the target date, put in the
variable RecDate, set to yesterday).

-Jeffrey Berman


----- Attachment follows -----

global RecDate

set RecDate to date "Friday, November 14, 2003 12:00:00 AM"

tell application "Microsoft Entourage" to �
    get folders of default mail account
DateMatch for result

on DateMatch for FolderList
    repeat with MailFolder in FolderList
        tell application "Microsoft Entourage"
            get (messages of MailFolder whose time received � RecDate)
            if (count of result) > 0 then return true
            set SubFolders to folders of MailFolder
        end tell
        
        if (count of SubFolders) > 0 then DateMatch for SubFolders
    end repeat
    
    return false
end DateMatch

----- End of attachment -----

--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to