Benches macOS

6

Address Book Plug-Ins: Age

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I have an Address Book plug-in that showed the age of a person when clicked on the "Birthday" label. Since installing Snow Leopard this stopped working. The script is still where it's supposed to be, and other scripts in the "Address Book Plug-Ins" folder still work. Any idea why the age script stopped working, and how I can make it work again?

The script – I don't remember where I found it – now looks like this:

{quote}

<pre>

(* This script adds a popup to birthday field that shows the persons age *)

using terms from application "Address Book"

on calculateAge(bdate)

set age to ((year of (current date)) - 1 - (year of bdate))

if (month of (current date) > (month of bdate)) then

set age to age + 1

else if (month of (current date) = (month of bdate)) then

if (day of (current date) ≥ (day of bdate)) then

set age to age + 1

end if

end if

return age

end calculateAge

on action property

return "birth date"

end action property

on action title for p with e

set userAge to calculateAge(e)

return (name of p & " is " & (userAge as string)) & " years old"

end action title

on should enable action for p with e

return true

end should enable action

on perform action for p with e

set userAge to calculateAge(e)

display dialog (name of p & " is " & (userAge as string)) ¬

& " years old"

end perform action

end using terms from

</pre>

{quote}

6 replies

Sign in or join Beachball Help to reply.

  1. 0

    Golden Shoes

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Greetings,

    If it's a plugin, then it was probably a PowerPC bundle, for which there is no support for in Snow Leopard. If it's

    a script. then the scripting terms for Address Book in Snow Leopard may have changed, so you'd have to rewrite

    it work again, or find another script that is compatible in Snow Leopard.

  2. 0

    Martijn

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I expected it would be something like that.

    Unfortunately I'm no Applescript specialist, and looking in the Applescript Editor Library for Address Book, I couldn't find anything helpful either.

    Anyone knows more about it?

  3. 0

    bneely

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    AppleScript plugins will work regardless of the Mac architecture (PPC or Intel). However, there is a specific problem with the birthday property. If you look in Console when you try to use this plugin, you will see an Address Book error message along the lines of "record is still nil".

    Message was edited by: bneely

  4. 0

    Martijn

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It says:


    06-10-09 00:18:04 Address Book[7035] -[ABDatumView record]... record is still nil!
    06-10-09 00:18:04 Address Book[7035] * Assertion failure in -[NSMenuItem initWithTitle:action:keyEquivalent:], /SourceCache/AppKit/AppKit-1038.11/Menus.subproj/NSMenuItem.m:270
    06-10-09 00:18:04 Address Book[7035] Invalid parameter not satisfying: aString != nil

    Does that help?

  5. 0

    Andreas Amann

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Martijn,

    looks like a bug in the Address Book application itself, not the script. It seems as if adding custom actions to the birth date property are currently broken - the simplest implementation:


    using terms from application "Address Book"
    on action property
    return "birth date"
    end action property

    on action title for person with bday
    return "Test"
    end action title

    on should enable action for person with bday
    return false
    end should enable action
    end using terms from

    does not work (whereas it works just fine when replacing "birth date" with "phone" to display "Test" on any phone number label.

    I suggest that you submit a bug report about this to Apple

    http://bugreport.apple.com (developer account required)

    or at least let them know about the issue

    http://www.apple.com/feedback/macosx.html

    Andreas
    User uploaded file

  6. 0

    Martijn

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Ah okay, I sent feedback, and I'll just wait for a bug fix then.

    Thank you for investigating the issue!