• 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: [Mail.app] Automated People Sorting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mail.app] Automated People Sorting


  • Subject: Re: [Mail.app] Automated People Sorting
  • From: John Delacour <email@hidden>
  • Date: Fri, 1 Aug 2003 20:46:16 +0100
  • Mac-eudora-version: 6.0a29

At 10:05 am -0700 1/8/03, Matt Petrowsky wrote:

I was wondering if anyone on this list has an AppleScript that would work with Mail to automate the following process.

1. Cycle through a selection of multiple messages or one full folder.
2. Determine if sender matches criteria (either in Address Book or on predefined text list)
3. Moves their messages into a folder (of their name - create if needed) into a subfolder named People


This is actually something Mail can do well. The script below is just a _working_and_tested_ example, but it is by no means reliable -- you need to catch all errors and deal with them properly rather than mask them in a big try. You also need to parse the address better to get a good name ('extract name from' is broken) and do all sorts of other things, but in principle it works and might serve as a guide for what you want to do.

I have not used the 'move' command in case it does not work in your version.


tell application "Mail"
set _targetmailbox to mailbox "INBOX" of account 1
set _searchstring to "@"
set _people to "People"
if not (exists mailbox _people) then
make mailbox with properties {name:_people}
end if
set ls to messages of _targetmailbox whose sender contains _searchstring
repeat with i in ls
try
set _message to contents of i
set _nameaddress to sender of _message
set my text item delimiters to " <"
set _mailbox to _people & "/" & first text item of _nameaddress
make mailbox with properties {name:_mailbox}
set mailbox of _message to mailbox _mailbox
end try
end repeat
end tell


-- JD




.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >[Mail.app] Automated People Sorting (From: Matt Petrowsky <email@hidden>)

  • Prev by Date: HTML mail
  • Next by Date: Re: Script to Get Finder Selection?
  • Previous by thread: [Mail.app] Automated People Sorting
  • Next by thread: Re: UI Scripting FileMaker
  • Index(es):
    • Date
    • Thread