[X4U] Need Applescript help for Mail

robert at elastica.com robert at elastica.com
Thu May 12 08:22:41 PDT 2005


Why anyone would stick with Entourage over Mail in Tiger is beyond me.

Firstly, Entourage uses a proprietory database format keeping all your mail in
the one file. 

Secondly because of Firstly, Entourage doesn't work nicely with Spotlight
because Spotlight works by file.

Quoting John McGibney <ensignjd at optonline.net>:

> I agree with you about Mail. I've been using Entourage for over a year. It
> can automate more stuff than Mail. I'm probably going to stick with
> Entourage. But Mail can display messages that Entourage chokes on. Entourage
> also pins the CPU on some messages just to display them.
> 
> Since upgrading to Tiger I felt I'd give Mail another try. But you still
> can't create a rule to delete messages based on subject and date sent. Nor
> can it delete messages when they're deleted from Mail, only after a set # of
> days.
> 
> Either way, thanks for the help. "Applescript for Dummies" is still too far
> over my head.
> 
> John 
> > 
> > Mail is a bear to script (that's one of the many reasons I use Entourage,
> an
> > actual shining example of scriptability!). But dictionary and syntax
> aside,
> > there are several problems with your script above. I can go into more
> detail
> > if you want, but in here are three:
> > 
> > - set localMailboxes to "Temp Save" is just assigning the value "Temp
> Save"
> > to a variable named localMailboxes, not referencing a mailbox as such
> > 
> > - "today" isn't an AppleScript constant, and you haven't defined what
> today
> > is
> > 
> > - "date sent" [of a particular message] returns a date object, including
> > time and day of the week, so something like "date sent greater than 5"
> isn't
> > going to work
> > 
> > Try something like the following, with the caveat that I've stayed away
> from
> > scripting, or even dealing with(!), Mail. I'm just going by its dictionary
> > and some scripting logic:
> > 
> > ---------- BEGIN SCRIPT ----------
> > 
> > set today to date string of (current date)
> > 
> > tell application "Mail"
> >   
> >   set theseMessages to every message of mailbox "Temp Save"
> >   
> >   repeat with thisMessage in theseMessages
> >       
> >       set msgDate to date sent of thisMessage
> >       set msgDateString to date string of msgDate
> >       
> >       if subject of thisMessage contains "Digest" and msgDateString is not
> > today then -- watch line wraps; should all be on one line
> >           
> >           delete thisMessage
> >           
> >       else
> >           
> >           if (current date) - (date sent of thisMessage) is greater than
> > (5 * days) then delete thisMessage -- watch line wraps; should be one line
> >           
> >       end if
> >       
> >   end repeat
> >   
> > end tell
> > 
> > ----------- END SCRIPT -----------
> > 
> > This isn't tested, but I think it's more along the lines of what you're
> > after.
> > 
> > -- Bill
> 
> -- 
>  One OS to rule them all, One OS to find them.
>  One OS to bring them all and in anti-competitive practices bind them.
>  In the land of M$ where the Shadow lies.
> 
> 
> _______________________________________________
> X4U mailing list
> X4U at listserver.themacintoshguy.com
> http://listserver.themacintoshguy.com/mailman/listinfo/x4u
> 
> Listmom is trying to clean out his closets! Vintage Mac and random stuff:
>          http://search.ebay.com/_W0QQsassZmacguy1984
> 




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the X4U mailing list