Most of the macro programs allow executing a script by clicking on window parts, a screen area, or a window area. The script would contain the code or keystrokes to Maximize/Restore the current window or a specified window.
I use AutoHotkey and Macro Express. In this case I'd use Macro Express because it would be easy.