• 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: Parsing phone/emails in Address Book
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parsing phone/emails in Address Book


  • Subject: Re: Parsing phone/emails in Address Book
  • From: Matthew Smith <email@hidden>
  • Date: Sat, 08 Mar 2003 15:13:44 +1100

on 08/03/2003 14:31, Darwin Zins at email@hidden wrote:

> I am new to applescript and I was wondering if there is a
> better/preferred/less verbose way to do this:
>
> tell application "Address Book"
> set peopleCount to the count of people
> end tell
>
> repeat with i from 1 to the peopleCount
> tell application "Address Book"
> tell person i
>
> set a_phones to {}
> set phoneRef to (a reference to a_phones)
> set phoneCount to the count of phones
> set existingPhones to (every phone)
> repeat with j from 1 to the phoneCount
> set currentItem to item j of existingPhones
> copy value of currentItem to the end of phoneRef
> end repeat
>
> set a_emails to {}
> set emailRef to (a reference to a_emails)
> set emailCount to the count of emails
> set existingEmails to (every email)
> repeat with j from 1 to the emailCount
> set currentItem to item j of existingEmails
> copy value of currentItem to the end of emailRef
> end repeat

Why not:

tell application "Address Book"
set peopleList to every person
repeat with onePerson in peopleList
set phoneList to value of every phone of onePerson
set emailLIst to value of every email of onePerson
-- now do something with each list
end repeat
end tell

--
Matthew Smith
_______________________________________________
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: 
 >Parsing phone/emails in Address Book (From: Darwin Zins <email@hidden>)

  • Prev by Date: Re: Parsing phone/emails in Address Book
  • Next by Date: Re: Searching for the equivalent of coercing to type "record"
  • Previous by thread: Re: Parsing phone/emails in Address Book
  • Next by thread: Simple request
  • Index(es):
    • Date
    • Thread