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) & " is " & ¬
(((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) & " is " & ¬
(((year of (current date)) - (year of e) - 1) ¬
as string) & " years old"
end if
end if
return (first name of p) & " is " & ¬
(((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