AutoHotkey: Script to Toggle Maximize Window


This page is a simple AutoHotkey script to toggle the current window's size. If you don't know what AutoHotkey is, see AutoHotkey Tutorial.

; 2011-04-30
; from
; A toggle. maximize current window, or restor size if already maximized.

WinGetPos, winWidth, winHeight, , , A  ; "A" to get the active window's pos.
if ( winWidth == -8 and winHeight == -8) {
WinRestore, A
} else
WinMaximize, A


Save the above in a file, name it 〔toggle window maximize restore.ahk〕.

Then, in your main AutoHotkey file, you can assign a key to it, like this:

$ScrollLock::Run "toggle window maximize restore.ahk"

Or, you can use your Microsoft or Logitech software keyboard driver software to assign a key to launch the script.

blog comments powered by Disqus