using this code:
Loop
{
WinWait, Untitled - Notepad
WinClose, Untitled - Notepad
}
I want to keep any new notepad windows closed automatically.
And then I want to add a keyboard shortcut to exit AHK script: Esc::ExitApp
but when I add Esc::ExitApp
the loop seems not working and notepad windows will not be closed automatically while code is still running:
Esc::ExitApp ; ==> this line causing the loop to malfunction and not work as expected
Loop
{
WinWait, Untitled - Notepad
WinClose, Untitled - Notepad
}
Why this is happening and how can I make it work as expected?!