Creating a shortcut for Zooming (maximizing) windows that actually works on every app

keyboardwindow-managerzoom

As of MacOS 10.6.6, there's no keyboard shortcut that I know of for zooming (maximizing) the window.
There's ⌘M to minimize, though.
I made a custom shortcut, defined it on the keyboard preferences pane, but as it identifies the menu command by name ("zoom"), it clashes with other commands in some applications, for example this one I'm using right now, Firefox. It briefly highlights the view menu, giving me a hint that the command matched by "zoom" is inside that menu, but in this case, zoom is just a submenu that has the options zoom in and zoom out, but it's obviously not related to zooming the window.
Is there any other way of setting this shortcut to work in such cases?

Best Answer

The following Applescript will trigger the zoom button (that´s button 2) in the frontmost application´s window. You could make this a service and define a global shortcut for it or use an application like quicksilver to call it.

tell application "System Events"
set frontApplication to (get name of every process whose frontmost is true) as string
tell process frontApplication
    click button 2 of window 1
end tell
end tell