Re: Organizing mail into mail folders with Applescript?
Re: Organizing mail into mail folders with Applescript?
- Subject: Re: Organizing mail into mail folders with Applescript?
- From: Axel Luttgens <email@hidden>
- Date: Sat, 30 Jan 2010 17:36:23 +0100
Le 29 janv. 2010 à 16:10:25, Konrad Michels a écrit :
> 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
Hello Konrad,
Does your inbox have only those three sub-mailboxes, "chronicle", "svn" and "opsnotify"?
If yes, perhaps could you try this one for the read status part:
tell application "Mail"
tell account "email@hidden"
tell mailbox "Inbox"
tell mailboxes
set read status of messages to true
end tell
end tell
end tell
end tell
I'm not privileged enough (?) to have an account on an exchange server, but it worked here against an account on a (more or less) regular IMAP server.
Should you be interested in a subset of the sub-mailboxes only, replacing:
tell mailboxes
by:
tell mailboxes whose name is "chronicle" or name is "svn" or name is "opsnotify"
should be OK as well.
(a cleaner form would be ... whose name is in {"chronicle", "svn", "opsnotify"}, but I never managed to have it working in Mail.app)
Could you tell us whether such bulk addressing of messages on an exchange server appears to be realistic/reliable?
Axel
_______________________________________________
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