Created
May 10, 2009 05:40
-
-
Save wesmaldonado/109513 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'appscript' | |
include Appscript | |
ab = app("Address Book") | |
group_name = "Missing Phone Numbers" | |
if ab.groups['Missing Phone Numbers'].eq(:missing_value) | |
puts "Creating a group named '#{group_name}'" | |
ab.make(:new => :group, :with_properties => {:name => group_name}) | |
end | |
ab.people[its.phones.eq([])].add(:to => ab.groups[group_name]) | |
# To edit properties of a person do this: | |
# | |
# wes = ab.people["Wes Maldonado"].get # <= the call to get actually executes the search | |
# p wes.first_name.get # 'Wes' | |
# wes.first_name.set('Wesley') | |
# p wes.first_name.get # 'Wesley' | |
# You need to save your changes, really. | |
ab.save_addressbook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment