Code: Select all
Run, Notepad.exe
WinWait, Untitled - Notepad, , 120
Loop, 60
{
WinMaximize, Untitled - Notepad
Sleep, 1000
}
While it's running, drag the window by its title bar around the screen; this "restores" the window to its normal size. If you do it really quickly, the WinMaximize works. You can do this repeatedly. But if you drag it around for a few seconds, the WinMaximize stops working. Then if you manually maximize the window again, the WinMaximize starts working again for quick window drags.
The failure looks like it involves the script trying to do the maximize while the window is being dragged. That AHK then thinks the window is still maximized, and doesn't bother trying to re-maximize it. Or something like that.