• 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: Any applescript to do this?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any applescript to do this?


  • Subject: Re: Any applescript to do this?
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 4 Nov 2005 22:16:52 -0700


On Nov 4, 2005, at 9:27 PM, Robert Nicholson wrote:

You can drag email addresses over groups in Address Book but I don't see see anyway to drag muitple addresses at one time.So for instance you have a smart mailbox to show you the messages you want and then you want to get those email addresses into a group in Address Book.

The first hurdle is that Applescript doesn't know about smart mailboxes.  You would either have to write the same criteria into Applescript that is used for the smart mailbox, or would have to use some other method to group the mail.

Here is a proposed solution:

tell application "Mail"
tell message viewer 1
set fits_criteria to messages ¬
whose subject contains "Test"
repeat with this_message in fits_criteria
set this_address to ¬
extract address from sender of this_message
my add_to_address_book(this_address)
end repeat
end tell
end tell

on add_to_address_book(address_)
tell application "Address Book"
set new_contact to make new person
tell new_contact
make new email at beginning of emails ¬
with properties ¬
{label:"Test", value:address_}
end tell
add new_contact to group "Test"
save addressbook
end tell
end add_to_address_book

It is not a complete solution because it doesn't populate the various name-related properties of the contacts.  I'm leaving that as "an exercise for the student." <g>

-- Michelle

-- 
Social Security Privatization: a solution in search of a problem.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Any applescript to do this?
      • From: Robert Nicholson <email@hidden>
References: 
 >Any applescript to do this? (From: Robert Nicholson <email@hidden>)

  • Prev by Date: Re: Extract from result of current date
  • Next by Date: Re: Extract from result of current date
  • Previous by thread: Any applescript to do this?
  • Next by thread: Re: Any applescript to do this?
  • Index(es):
    • Date
    • Thread