• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Organizing mail into mail folders with Applescript?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Organizing mail into mail folders with Applescript?


  • Subject: Re: Organizing mail into mail folders with Applescript?
  • From: Konrad Michels <email@hidden>
  • Date: Fri, 29 Jan 2010 07:10:25 -0800

Apologies for coming into this discussion late - just found it in the archives on lists.apple.com, and also can't find a way to reply directly to the thread on the web.

So I've been looking at a similar scenario, but have a slightly different arrangement of mailboxen:

On the company exchange server:

- work account inbox
+ svn
+ chronicle
+ opsnotify

On my Mac:

- work archive
+ 2008
+200810
+200811
+200812
+2009
+200901
+200902
etc ...
+2010
+ 201001

What I'm trying to do is to write a script that goes through the work account subfolders, such as "svn", "chronicle" etc, marks the messages as read, and then moves them to the "work archive" mailbox subfolder on my mac that corresponds with the month the message was received.

I am really new to Applescript and struggling to wrap my head around it whilst holding down a busy job and still finding time for the family etc etc etc, so it is ugly.  If these were files in a unix filesystem I could throw together something in 10 minutes in bash to do this really elegantly, but its not :-(
Any assistance would be appreciated.  

I know it is insanely clumsy to do an individual tell for each mailbox, and I did try a "tell mailbox {"chronicle", "svn", "opsnotify"}, but the repeat kept failing with an integer error.  So I know I've just missed something on that front.

On the message move front, I can fairly easily get it to move a message to the "work archive" main mailbox, but can't figure out a way to specify the actual subfolder I want the mail in.

tell application "Mail"
tell account "email@hidden"
tell mailbox "Inbox"
tell mailbox "chronicle"
repeat with eachMessage in "chronicle"
set read status of (every message whose read status is false) to true
end repeat
end tell
tell mailbox "svn"
repeat with eachMessage in "svn"
set read status of (every message whose read status is false) to true
end repeat
end tell
tell mailbox "opsnotify"
repeat with eachMessage in "opsnotify"
set read status of (every message whose read status is false) to true
end repeat
end tell
end tell
end tell
end tell

Many thanks

Konrad
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Organizing mail into mail folders with Applescript?
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: URL Access Scripting file size limitations? (Leopard)
  • Next by Date: Re: Send outgoing message error from Mail.app
  • Previous by thread: Re: Organizing mail into mail folders with Applescript?
  • Next by thread: Re: Organizing mail into mail folders with Applescript?
  • Index(es):
    • Date
    • Thread