Jan 20, '04 10:49:00AM • Contributed by: dmmorse
The first script is applied to the phone number fields and will automatically perform a reverse phone number look-up using Google. While I realize such look-ups are not always successful, sometimes they are the last resort and can turn up an address when I would otherwise have none.
The second script is applied to the birthday field and simply tells me how old somebody is.
To use the scripts, simply cut and paste the text below into a blank Script Editor document and save as a script in the ~/Library -> Address Book Plug-Ins directory. Then quit Address Book if it is open and relaunch it. Voila!
Reverse Look-Up script:
using terms from application "Address Book"
on action property
return "phone"
end action property
on action title for aPerson with aPhone
return "Look Up Address"
end action title
on should enable action for aPerson with aPhone
return true
end should enable action
on perform action for aPerson with aPhone
set thephone to ((value of aPhone) as string)
set thephone to (characters 1 thru 3 of thephone) & " " &¬
(characters 5 thru 7 of thephone) & " " &¬
(characters 9 thru 12 of thephone)
tell application "Safari"
activate
open location "http://www.google.com/search?q=" & thephone
end tell
end perform action
end using terms from
Show Age Script:
using terms from application "Address Book"
on action property
return "birth date"
end action property
on action title for p with e
set monthnow to (month of (current date) as number)
set daynow to (day of (current date) as number)
set monthcheck to ((month of e) as number)
set daycheck to ((day of e) as number)
if monthnow < monthcheck then
return (first name of p) & " " &¬
(((year of (current date)) - (year of e) - 1)¬
as string) & " years old"
else
if monthnow = monthcheck then
if daynow < daycheck then
return (first name of p) & " " &¬
(((year of (current date)) - (year of e) - 1)¬
as string) & " years old"
end if
end if
return (first name of p) & " " &¬
(((year of (current date)) - (year of e))¬
as string) & " years old"
end if
end action title
on should enable action for p with e
return true
end should enable action
end using terms from
