Hello,
I’m a total newbie to MacScripter and applescripting, although I have written shell scripts in my past as a Solaris system administrator. I am currently a proud, relatively new owner of an iMac - finally threw the windows box in the closet.
I would like to be able to display, in iCal, the age of everyone in my Birthday calendar.
I found the following script here:
http://hints.macworld.com/article.php?story=20040105125520276
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
It compiles and runs, but nothing happens, either in Address Book or iCal.
I found a post here:
https://discussions.apple.com/thread/2187193?start=0&tstart=0
that says it’s a bug in Address Book and sure enough, when I looked in the Console I found the very same error message.
All of this is fairly old and while the script calculates age, it wasn’t meant to display it in iCal.
I have searched through a lot of the forums here and don’t see anything that does this, although many come close.
Does anyone have any suggestions?
Thanks,
Vicky
AppleScript: 2.1.2
Browser: Safari 6534.50
Operating System: Mac OS X (10.6)