In some sense this is really a shortcoming of AppleScript. No developer should possibly have to know what name a menu item shows to the user, really.
I guess that's not AppleScript - it's System Events which is has an applescriptable interface.
In general, AppleScript is really a last resort...It is really very slow
There's a bit of overhead in context switching, but compiled AppleScript itself is not too shabby.
for simple math calculations I would really recommend the Ruby or the bc way.
Indeed. php also has good math library built in, including arbitrary precision stuff.
I think, given that all OS X system have cmd line php working out of the box, that it is underused as a scripting language for TextMate. There are a ton of easy to use functions to aid the scripter, and it is a very easy to learn language, in my experience.
There are lots of books on PHP 4-5 (amazon is your friend), helper apps like
http://www.artissoftware.com/phpfi/
And, as a freebee, you learn a nice web-programming language
tim