Scriptable menu bar icons Is there an easy way I can add custom icons to the menu bar status area? Ideally something like Growl (e.g., where you can just execute a command) but instead of notifications, just renders icons in the menu bar.

I'm mainly looking to draw numbers that I'd use to alert me of various things. For example, I can configure my email client to run a command/AppleScript to update the numbers when an certain kind of email arrives.

Something like this:
I would suggest starting with this thread, which describes using Cocoa Objective-C calls from within AppleScript. There is an example Xcode project here.

And Launch is a complete application written in AppleScript that functionally does this. Its Xcode project file is here.

The basic premise is to generate NSMenuItem instances and add them to the system's NSStatusBar:

set statusMenu to (NSMenu's alloc)'s initWithTitle_("Launch")
-- (build and do stuff with the statusMenu here)
set sysStatusBar to NSStatusBar's systemStatusBar
set statusItem to sysStatusBar's statusItemWithLength_(32)
tell statusItem to setMenu_(statusMenu)
tell statusItem to setHighlightMode_(1)
set menuImage to NSImage's imageNamed_("icon.png")
tell statusItem to setImage_(menuImage)


AppleScript excerpt from Launch's source code, Copyright &copy; Lee Hanken