; Stupid simple autoit script for cleaning up "orphaned" notepad instances
; I end up with dozens of notepad instances after a day of coding and it's a pain to close all these manually
; as I do want to keep some of them.
; Public Domain
; Philip Bjorge
; June 2, 2012
Local $windows=WinList()
For $i = 1 To $windows[0][0]
If StringInStr($windows[$i][0], "Notepad", 0) Then
WinSetState($windows[$i][1], "", @SW_MAXIMIZE)
If MsgBox(4, "Notepad Cleaner", "Do you want to kill this notepad instance?", 0, $windows[$i][1]) = 6 Then
WinClose($windows[$i][1])
WinWaitActive("Notepad", "Save")
;WinWaitActive("Notepad", "Do you want to save") ; When running under Windows XP
Send("!n")
EndIf
EndIf
Next