• 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: address book entries by date created
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address book entries by date created


  • Subject: Re: address book entries by date created
  • From: Christian Boyce <email@hidden>
  • Date: Mon, 20 Jun 2011 13:00:02 -0700

Way better. I was lazy twice: once when I didn't check for existence of the group, and also when I just picked a start date and not an end date.

I like using "set foundGroup to people whose creation date ..." instead of "every person whose". Had not seen that used before.

The nice thing about putting people into the group is they may not have names, or emails, or whatever, so you can't rely on "names of people whose" in your list.

Is there a way to eliminate the "repeat with i in foundGroup" loop? Add every item of foundGroup to group "tempgroup"? I haven't figured it out.

Finally, better have a "Save" in the script. Try it with and without out you'll like it better with.

Here's a shorter example (do it with Address Book open so you can see it happen):

tell application "Address Book"
make new group at end with properties {name:"tempgroup"}
save
end tell

that works.

Take out the Save and it doesn't work. At least not here. Leaving out the Save has messed me up plenty of times with Address Book scripting.

c

 
On Jun 20, 2011, at 12:04 PM, Christopher Stone wrote:

On Jun 20, 2011, at 00:33, Christian Boyce wrote:
Or, create a group in Address Book and take all of those people that you find in Chris' script (below) and put them into that group. 
______________________________________________________________________

Hey Christian,

That's certainly a more organic way of handling things.  Let's see if we can improve on it just a smidgen.

--
Best Regards,
Chris

set dateRangeStart to date "Tuesday, September 14, 2010 00:00:00"
set dateRangeEnd to date "Wednesday, September 15, 2010 00:00:00"

tell application "Address Book"
activate
try
if (group "tempgroup" exists) = false then
set newGroup to make new group at end with properties {name:"tempgroup"}
set foundGroup to people whose creation date > dateRangeStart and creation date < dateRangeEnd
repeat with i in foundGroup
add i to group "tempgroup"
end repeat
save
set selected of group "tempgroup" to true
else
error "Group 'tempgroup' Already Exists!"
end if
on error errMsg number errNum
set sep to "=============================="
set e to sep & return & "Error: " & errMsg & return & sep & return ¬
& "Error Number: " & errNum & return & sep
beep
display dialog e
end try
end tell



--
Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants
310-452-3720

Read the Boyce Blog: http://christianboyce.blogspot.com
Follow us on Twitter! http://twitter.com/christianboyce
Be a fan on Facebook! http://tinyurl.com/cboyce-and-associates-facebook

Now Playing on The Boyce Blog: Search Google Images by COLOR

 _______________________________________________
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

  • Follow-Ups:
    • Re: address book entries by date created
      • From: Christopher Stone <email@hidden>
References: 
 >address book entries by date created (From: Joshua Whalen <email@hidden>)
 >Re: address book entries by date created (From: Christopher Stone <email@hidden>)
 >Re: address book entries by date created (From: Christian Boyce <email@hidden>)
 >Re: address book entries by date created (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: disclosure triangle detection
  • Next by Date: Re: disclosure triangle detection
  • Previous by thread: Re: address book entries by date created
  • Next by thread: Re: address book entries by date created
  • Index(es):
    • Date
    • Thread