• 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: Get the address data without Address Book running?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get the address data without Address Book running?


  • Subject: Re: Get the address data without Address Book running?
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 24 Jan 2004 13:22:16 -0600

At 11:47 -0600 01/24/2004, Christopher Stone wrought:

This regex may not cover all the possibilities, but it gives the general idea.
______________________________________________________________________

Hmm. I didn't really examine the content of the regex except for valid email addresses. The regex takes about eight seconds to run on my machine, so I decided to see how fast it would be to script the Address Book.

Testing revealed to me that the regex was getting a bunch of duplicates.

It seems that it only takes about three seconds to launch the Address Book and get the email address, *but* there are 4 fewer than I get from the regex (minus dupes).

<scratching head>

----------------------------------------------------------------------

Pure Address Book:

set emailList to {}

tell application "Address Book"
set pCnt to count of people
repeat with i from 1 to pCnt
set emVal to value of every email of person i
if emVal is not {} then
set emailList to emailList & emVal
end if
end repeat
end tell
emailList

Takes about 1 second on my machine.

These results are with the Address Book running. If it isn't running the process takes about 3 seconds.

----------------------------------------------------------------------

Using the Address Book and the Satimage osax:

tell application "Address Book"
set AppleScript's text item delimiters to {return}
set emAdrs to value of emails of every person as string
set emAdrs to change "^\\r" into "" in emAdrs with regexp without case sensitive
set emAdrs to change "[[:space:]]+$" into "" in emAdrs regexpflag {"EXTENDED", "ICASE"} with regexp without case sensitive
set emAdrs to paragraphs of emAdrs
end tell

Takes about 0.3 seconds on my machine


These results are with the Address Book running. If it isn't running the process takes a bit less than 3 seconds.

----------------------------------------------------------------------

tell application "Address Book"
value of every email of every person
end tell

This only takes about 0.2 seconds but it produces a bunch of empty values along with the good ones. Is there any way to get *only* the good values via a whose clause?


Chris
_______________________________________________
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: 
 >Get the address data without Address Book running? (From: fortepianissimo <email@hidden>)
 >Re: Get the address data without Address Book running? (From: Christopher Stone <email@hidden>)

  • Prev by Date: Filemaker 'whose' clause broken?
  • Next by Date: Re: [iCal] what is the sequence?
  • Previous by thread: Re: Get the address data without Address Book running?
  • Next by thread: System Profiler dictionary in 10.3?
  • Index(es):
    • Date
    • Thread