Maximise OS X windows with a keyboard shortcut

Save this Applescript in ~/Library/Scripts, assign a keyboard shortcut to it with Quicksilver (Triggers) and hey presto:

set resolution to words of (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution")
set {width, height} to {item 2, item 4} of resolution
tell application (path to frontmost application as string)
  set bounds of front window to {0, 22, width, height}
end tell

Doesn't seem to work in all applications though...

Update: Sven's solution should work in all applications, even those that don't support Applescript:


set resolution to words of (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution")
set {width, height} to {item 2, item 4} of resolution
tell application "System Events"
  tell (first process whose frontmost is true)
    set position of first window to {0, 22}
    set size of first window to {width, height}
  end tell
end tell